diff --git a/pom.xml b/pom.xml index 24b5263..09ae456 100644 --- a/pom.xml +++ b/pom.xml @@ -57,6 +57,12 @@ json 20240303 + + org.junit.jupiter + junit-jupiter-engine + 5.11.3 + test + diff --git a/src/test/java/com/lbry/globe/tests/GeoIPTest.java b/src/test/java/com/lbry/globe/tests/GeoIPTest.java new file mode 100644 index 0000000..62ad76c --- /dev/null +++ b/src/test/java/com/lbry/globe/tests/GeoIPTest.java @@ -0,0 +1,19 @@ +package com.lbry.globe.tests; + +import com.lbry.globe.util.GeoIP; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + +public class GeoIPTest{ + + @Test + public void testGetCoordinateFromLocation(){ + assertArrayEquals(new Double[]{123.0,456.0},GeoIP.getCoordinateFromLocation("123,456")); + assertArrayEquals(new Double[]{123.125,456.125},GeoIP.getCoordinateFromLocation("123.125,456.125")); + assertArrayEquals(new Double[]{123.25,456.25},GeoIP.getCoordinateFromLocation("123.25,456.25")); + assertArrayEquals(new Double[]{123.5,456.5},GeoIP.getCoordinateFromLocation("123.5,456.5")); + } + +} \ No newline at end of file