GeoCoordinate implements Comparable<GeoCoordinate> { @Override public String toString() { return "latitude: " + this.latitude + ", longitude: " + this.longitude; } GeoCoordinate(double latitude, double longitude);  GeoCoordinate(int latitudeE6, int longitudeE6);  GeoCoordinate(String wellKnownText); static GeoCoordinate fromString(String latLonString); static double validateLatitude(double lat); static double validateLongitude(double lon); double getLatitude(); double getLongitude(); int getLatitudeE6(); int getLongitudeE6(); double sphericalDistance(GeoCoordinate other); static double sphericalDistance(GeoCoordinate gc1, GeoCoordinate gc2); static double sphericalDistance(double lon1, double lat1, double lon2, double lat2); static double sphericalDistance(int lon1, int lat1, int lon2, int lat2); double vincentyDistance(GeoCoordinate other); static double vincentyDistance(GeoCoordinate gc1, GeoCoordinate gc2); static double latitudeDistance(int meters); static double longitudeDistance(int meters, double latitude); static double longitudeDistance(int meters, int latitude); static int doubleToInt(double coordinate); static double intToDouble(int coordinate); @Override boolean equals(Object obj); @Override int compareTo(GeoCoordinate geoCoordinate); @Override int hashCode(); @Override String toString(); static final double FACTOR_DOUBLE_TO_INT; static final double LATITUDE_MAX; static final double LATITUDE_MIN; static final double LONGITUDE_MAX; static final double LONGITUDE_MIN; }
@Test(expected = IllegalArgumentException.class) public void geoCoordinateIllegalLongitudeTest() { GeoCoordinate invalidCoordinate = new GeoCoordinate(0d, 181d); fail("invalid coordinate must throw exception: " + invalidCoordinate.toString()); }
@Test(expected = IllegalArgumentException.class) public void geoCoordinateIllegalLatitudeTest() { GeoCoordinate invalidCoordinate = new GeoCoordinate(91d, 0d); fail("invalid coordinate must throw exception: " + invalidCoordinate.toString()); }