### Question:
GeopositionComparator implements Comparator { public double compare(String v1, String v2) { try { double lat1 = getLatitude(v1); double lon1 = getLongitude(v1); double lat2 = getLatitude(v2); double lon2 = getLongitude(v2); if (!valid(lat1, lon1) || !valid(lat2, lon2)) return 0.5; double dist = distance(lat1, lon1, lat2, lon2); if (dist > maxdist) return 0.0; return ((1.0 - (dist / maxdist)) * 0.5 ) + 0.5; } catch (NumberFormatException e) { if (strict) throw new DukeException("Invalid number: " + e, e); return 0.5; } } GeopositionComparator(); boolean isTokenized(); double compare(String v1, String v2); void setStrict(boolean strict); void setMaxDistance(double maxdist); double getMaxDistance(); static double distance(double lat1, double lon1,
                                double lat2, double lon2);  }### Answer:
@Test public void testEmpty() { assertEquals(0.5, comp.compare("", "")); }
@Test public void testMalformed() { assertEquals(0.5, comp.compare("41.5,27.2", "41.5127.21")); }
@Test public void testMalformed2() { assertEquals(0.5, comp.compare("41.5,27.2", "1231,123123")); }
@Test public void testOsloKiev() { assertEquals(0.0, comp.compare("59.913869,10.752245", "50.45,30.5234")); }