From a743e770ce682f7e29b013c379244b64bc70d211 Mon Sep 17 00:00:00 2001 From: Ben van Hartingsveldt Date: Mon, 2 Dec 2024 13:35:06 +0100 Subject: [PATCH] Add test --- pom.xml | 6 ++++++ .../java/com/lbry/globe/tests/GeoIPTest.java | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 src/test/java/com/lbry/globe/tests/GeoIPTest.java 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