From 8f737fc3c277f2321687cadc5e1eb3a321e76f57 Mon Sep 17 00:00:00 2001 From: anuragkumawat Date: Mon, 6 Sep 2021 19:58:33 +0530 Subject: [PATCH] JAVA-5947 - Changed the Integration Test to Manual Test and also added the comment to download the location file and run the test manually in code --- .../{GeoIpIntegrationTest.java => GeoIpManualTest.java} | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) rename spring-web-modules/spring-mvc-xml/src/test/java/com/baeldung/geoip/{GeoIpIntegrationTest.java => GeoIpManualTest.java} (68%) diff --git a/spring-web-modules/spring-mvc-xml/src/test/java/com/baeldung/geoip/GeoIpIntegrationTest.java b/spring-web-modules/spring-mvc-xml/src/test/java/com/baeldung/geoip/GeoIpManualTest.java similarity index 68% rename from spring-web-modules/spring-mvc-xml/src/test/java/com/baeldung/geoip/GeoIpIntegrationTest.java rename to spring-web-modules/spring-mvc-xml/src/test/java/com/baeldung/geoip/GeoIpManualTest.java index 206e9b6e52..5bfb78017c 100644 --- a/spring-web-modules/spring-mvc-xml/src/test/java/com/baeldung/geoip/GeoIpIntegrationTest.java +++ b/spring-web-modules/spring-mvc-xml/src/test/java/com/baeldung/geoip/GeoIpManualTest.java @@ -1,4 +1,4 @@ -package com.baeldung.geoip; +package test.java.com.baeldung.geoip; import java.io.File; import java.io.IOException; @@ -10,12 +10,17 @@ import com.maxmind.geoip2.DatabaseReader; import com.maxmind.geoip2.exception.GeoIp2Exception; import com.maxmind.geoip2.model.CityResponse; -public class GeoIpIntegrationTest { +public class GeoIpManualTest { @Test public void givenIP_whenFetchingCity_thenReturnsCityData() throws IOException, GeoIp2Exception { ClassLoader classLoader = getClass().getClassLoader(); + /** + * Download the db file as shown in the article https://www.baeldung.com/geolocation-by-ip-with-maxmind, + * then replace the "your-path-to-db-file" string in the test with the file path before running the test + * HINT : Copy the downloaded file at spring-web-modules/spring-mvc-xml/src/test/resources/GeoLite2-City.mmdb + * **/ File database = new File("your-path-to-db-file"); DatabaseReader dbReader = new DatabaseReader.Builder(database).build();