LocationExtensions { public static List<Position> sortByDistanceInMeters(final Position startPoint, final List<Position> geohashes) { return sortByDistance(startPoint, geohashes, MeasuringUnit.METER); }  static List<DistancePoint> getDistancePoints(final Position startPoint,
		final List<Position> geohashes, final MeasuringUnit unit); static String getGeohashFromIpAddress(final LookupService lookupService,
		final String ipAddress); static GeoHashPoint getGeoHashPoint(final LookupService lookupService,
		final String ipAddress); static List<Position> sortByDistance(final Position startPoint,
		final List<Position> geohashes, final MeasuringUnit unit); static List<Position> sortByDistanceInMeters(final Position startPoint,
		final List<Position> geohashes);  }
@Test public void testSortByDistanceInMeters() { List<Position> actual; List<Position> expected; List<Position> geohashes = ListFactory.newArrayList(); geohashes.add(new GeoHashPoint("u0vf2w1s5tsy")); geohashes.add(new GeoHashPoint("u0t3z7cnznrx")); geohashes.add(new GeoHashPoint("u0td0v9xnz28")); Position startPoint = new GeoHashPoint("u11fyhzqhp3c"); actual = LocationExtensions.sortByDistanceInMeters(startPoint, geohashes); expected = ListFactory.newArrayList(new GeoHashPoint("u0vf2w1s5tsy"), new GeoHashPoint("u0td0v9xnz28"), new GeoHashPoint("u0t3z7cnznrx")); for (int i = 0; i < actual.size(); i++) { assertEquals(expected.get(i), actual.get(i)); } geohashes = ListFactory.newArrayList(); geohashes.add(new GeoHashPoint("u0z4")); geohashes.add(new GeoHashPoint("u1p1")); geohashes.add(new GeoHashPoint("u28j")); geohashes.add(new GeoHashPoint("u0zc4wp0k")); startPoint = new GeoHashPoint("u0ww"); actual = LocationExtensions.sortByDistanceInMeters(startPoint, geohashes); expected = ListFactory.newArrayList(new GeoHashPoint(49.658203125d, 10.01953125d), new GeoHashPoint(49.42755460739136d, 11.018106937408447d), new GeoHashPoint(48.779296875d, 11.42578125d), new GeoHashPoint(50.888671875d, 10.01953125d)); for (int i = 0; i < actual.size(); i++) { assertEquals(expected.get(i), actual.get(i)); } }