/** This method performs format conversions with string constructors in degrees and dms */
  public void testRandomEquals() {
    for (int i = 0; i < 1000; i++) {
      Geodetic3DPoint a1 = randomGeoPoint(r);
      Geodetic3DPoint a2 =
          new Geodetic3DPoint(a1.getLongitude(), a1.getLatitude(), a1.getElevation());
      // note by making equals() work in round off errors (such as in this case) using
      // Angle.equals() vs phi1=phi2 && lamb1==lamb2
      // but break contract in hashCode such that a.equals(b) -> true but hashCode(a) may not equal
      // hashCode(b)
      assertEquals(a1, a2);
      assertEquals(a1.hashCode(), a2.hashCode());

      // for symmetric tests to work elevation must be non-zero
      final double elevation = a1.getElevation();
      if (elevation == 0.0 || Math.abs(elevation) < 1e-8) a1.setElevation(1234.5);

      // test symmetric equals tests a.equals(b) -> b.equals(a)
      Geodetic2DPoint pt2 = new Geodetic2DPoint(a1.getLongitude(), a1.getLatitude());
      assertFalse(pt2.equals(a1));
      assertFalse(a1.equals(pt2));
      a1.setElevation(0);
      assertEquals(pt2, a1); // pt2.equals(al) -> a1.equals(pt2)
      assertEquals(a1, pt2);
    }
  }
  public void testEquals() {
    // test equality with known geo-points
    assertEquals(a, b);
    assertFalse(a.equals(c));
    assertFalse(a.equals(d));
    assertFalse(c.equals(d));

    // test equality with any possible round off errors
    Geodetic3DPoint a2 =
        new Geodetic3DPoint(
            new Longitude(Math.toRadians(a.getLongitude().inDegrees())),
            new Latitude(Math.toRadians(a.getLatitude().inDegrees())),
            a.getElevation());
    assertEquals(a, a2);
    assertEquals(a.hashCode(), a2.hashCode());

    // approximate equals test for elevations up to 3 decimal places
    Geodetic3DPoint a3 =
        new Geodetic3DPoint(a.getLongitude(), a.getLatitude(), a.getElevation() + 10e-6);
    assertEquals(a, a3);
    assertEquals(a.hashCode(), a3.hashCode());
  }