@Test
public void testDistanceInMeters() {

    LOG.info("testDistanceInMeters");
    assertEquals(METERS_PER_DEGREE_LAT, distanceInMeters(
            new GeoPoint(-0.5, 0.0), new GeoPoint(0.5, -0.0)), DELTA);
    assertEquals(METERS_PER_DEGREE_LAT, distanceInMeters(
            new GeoPoint(80.0, 0.0), new GeoPoint(81.0, 0.0)), DELTA);
    assertTrue((abs(METERS_PER_DEGREE_LAT * 2) - distanceInMeters(
            new GeoPoint(0.0, 59.0), new GeoPoint(0.0, 61.0))) < DELTA);
    assertTrue((abs(METERS_PER_DEGREE_LAT * 1.4142135623731) - distanceInMeters(
            new GeoPoint(-1.0, -1.0), new GeoPoint(1.0, 1.0))) < DELTA);
    assertEquals(METERS_PER_DEGREE_LON_EQUATOR, distanceInMeters(
            new GeoPoint(0.0, -0.5), new GeoPoint(0.0, 0.5)), DELTA);
    assertEquals(METERS_PER_DEGREE_LON_EQUATOR, distanceInMeters(
            new GeoPoint(0.0, 80.0), new GeoPoint(0.0, 81.0)), DELTA);
    assertEquals(METERS_PER_DEGREE_LON_EQUATOR / 2.0, distanceInMeters(
            new GeoPoint(60.0, 80.0), new GeoPoint(60.0, 81.0)), DELTA);
    assertEquals(METERS_PER_DEGREE_LON_EQUATOR * 2, distanceInMeters(
            new GeoPoint(0.0, -1.0), new GeoPoint(0.0, 1.0)), DELTA);
    // Test latitude, longitude and elevation length.
    assertEquals(METERS_PER_DEGREE_LAT, distanceInMeters(new GeoPoint(-0.5, 0.0), new GeoPoint(0.5, 0.0)), DELTA);
    assertEquals(METERS_PER_DEGREE_LON_EQUATOR, distanceInMeters(new GeoPoint(0.0, -0.5), new GeoPoint(0.0, 0.5)), DELTA);
    assertEquals(2.0, distanceInMeters(new GeoPoint(0.0, 0.0, 0.0), new GeoPoint(0.0, 0.0, 2.0)), DELTA);
    assertEquals(sqrt((METERS_PER_DEGREE_LAT * METERS_PER_DEGREE_LAT) + (METERS_PER_DEGREE_LON_EQUATOR * METERS_PER_DEGREE_LON_EQUATOR)),
            distanceInMeters(new GeoPoint(-0.5, -0.5), new GeoPoint(0.5, 0.5)), DELTA);
    assertEquals(sqrt((METERS_PER_DEGREE_LAT * METERS_PER_DEGREE_LAT) + (METERS_PER_DEGREE_LON_EQUATOR * METERS_PER_DEGREE_LON_EQUATOR) + (2.0 * 2.0)),
            distanceInMeters(new GeoPoint(-0.5, -0.5, 0.0), new GeoPoint(0.5, 0.5, 2.0)), DELTA);
    // Test wrapping.
    assertTrue((distanceInMeters(new GeoPoint(0.0, -1.0), new GeoPoint(0.0, 1.0)) -
            distanceInMeters(new GeoPoint(0.0, 1.0), new GeoPoint(0.0, -1.0))) < DELTA);
    assertTrue((distanceInMeters(new GeoPoint(0.0, -180.0), new GeoPoint(0.0, LON180)) -
            distanceInMeters(new GeoPoint(0.0, LON180), new GeoPoint(0.0, -180.0))) < DELTA);
    assertTrue((distanceInMeters(new GeoPoint(0.0, -180.0), new GeoPoint(0.0, 0.0)) -
            distanceInMeters(new GeoPoint(0.0, -180.0), new GeoPoint(0.0, 0.0))) < DELTA);
}