This commit is contained in:
Ben van Hartingsveldt 2024-12-02 13:35:06 +01:00
parent a0f7389857
commit a743e770ce
No known key found for this signature in database
GPG key ID: 261AA214130CE7AB
2 changed files with 25 additions and 0 deletions

View file

@ -57,6 +57,12 @@
<artifactId>json</artifactId> <artifactId>json</artifactId>
<version>20240303</version> <version>20240303</version>
</dependency> </dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.11.3</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<properties> <properties>

View file

@ -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"));
}
}