From 453aacfbbb37fc447f3f385e056a51ca21e0e9b1 Mon Sep 17 00:00:00 2001 From: Hallvard Traetteberg <hal@ntnu.no> Date: Wed, 10 Jan 2018 22:51:35 +0100 Subject: [PATCH] Added test for removal of existing location. --- .../gr1800/app/core/GeoLocationsTest.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tdt4140-gr1800/app.core/src/test/java/tdt4140/gr1800/app/core/GeoLocationsTest.java b/tdt4140-gr1800/app.core/src/test/java/tdt4140/gr1800/app/core/GeoLocationsTest.java index 271248b..1cdd829 100644 --- a/tdt4140-gr1800/app.core/src/test/java/tdt4140/gr1800/app/core/GeoLocationsTest.java +++ b/tdt4140-gr1800/app.core/src/test/java/tdt4140/gr1800/app/core/GeoLocationsTest.java @@ -70,5 +70,19 @@ public class GeoLocationsTest { geoLocations.addLocation(latLong); LatLong nearestlocations = geoLocations.findNearestLocation(latLong); Assert.assertEquals(latLong, nearestlocations); - } + } + + @Test + public void testRemoveSameLocations() { + GeoLocations geoLocations1 = new GeoLocations(new LatLong(0, 0), new LatLong(1, 1)); + Assert.assertEquals(2, geoLocations1.size()); + geoLocations1.removeLocations(new LatLong(0, 0), 0.0); + Assert.assertEquals(1, geoLocations1.size()); + geoLocations1.removeLocations(new LatLong(1, 1), 0.0); + Assert.assertEquals(0, geoLocations1.size()); + GeoLocations geoLocations2 = new GeoLocations(new LatLong(0, 0), new LatLong(0, 0)); + Assert.assertEquals(2, geoLocations2.size()); + geoLocations2.removeLocations(new LatLong(0, 0), 0.0); + Assert.assertEquals(0, geoLocations2.size()); + } } -- GitLab