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

This commit is contained in:
anuragkumawat 2021-09-06 19:58:33 +05:30
parent 9794239442
commit 8f737fc3c2
1 changed files with 7 additions and 2 deletions

View File

@ -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();