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 66% 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 0aa23842b1..99a76099b2 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 @@ -10,13 +10,18 @@ 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(); - File database = new File(classLoader.getResource("GeoLite2-City.mmdb").getFile()); + /** + * 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(); InetAddress ipAddress = InetAddress.getByName("google.com");