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:
parent
9794239442
commit
8f737fc3c2
@ -1,4 +1,4 @@
|
|||||||
package com.baeldung.geoip;
|
package test.java.com.baeldung.geoip;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -10,12 +10,17 @@ import com.maxmind.geoip2.DatabaseReader;
|
|||||||
import com.maxmind.geoip2.exception.GeoIp2Exception;
|
import com.maxmind.geoip2.exception.GeoIp2Exception;
|
||||||
import com.maxmind.geoip2.model.CityResponse;
|
import com.maxmind.geoip2.model.CityResponse;
|
||||||
|
|
||||||
public class GeoIpIntegrationTest {
|
public class GeoIpManualTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenIP_whenFetchingCity_thenReturnsCityData() throws IOException, GeoIp2Exception {
|
public void givenIP_whenFetchingCity_thenReturnsCityData() throws IOException, GeoIp2Exception {
|
||||||
|
|
||||||
ClassLoader classLoader = getClass().getClassLoader();
|
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");
|
File database = new File("your-path-to-db-file");
|
||||||
DatabaseReader dbReader = new DatabaseReader.Builder(database).build();
|
DatabaseReader dbReader = new DatabaseReader.Builder(database).build();
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user