Skip to content

Commit

Permalink
add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adev4a committed Oct 2, 2024
1 parent a068339 commit 0dd449f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public MutableGeoPoint utmToGeographic(UtmPoint utmPoint, MutableGeoPoint result

transform.transform(sourceCoord, targetCoord);
//Transform returned as lon,lat = (targetCoord.x, targetCoord.y)
result.set(targetCoord.x, targetCoord.y, 0.0);
result.set(targetCoord.y, targetCoord.x, 0.0);

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ public void convertGeographictoUTM(){
assertEquals(actualUtmPoint.getNorthing(), calculatedUtmPoint.getNorthing(), 1d);
assertEquals(actualUtmPoint.getAltitude(), calculatedUtmPoint.getAltitude(), 1d);
assertEquals(18, calculatedUtmPoint.getZone().number);

//Test Special Zone Norway
GeoPoint testGeoPoint2 = GeoPoint.latLon(77.8750, 20.9752);
UtmPoint calculatedUtmPoint2 = transform.geographicToUtm(testGeoPoint2);
assertEquals(33, calculatedUtmPoint2.getZone().number);

//Test convert back to geographic
GeoPoint calculatedGeoPoint = transform.utmToGeographic(calculatedUtmPoint);
assertEquals(calculatedGeoPoint.getLatitude(), testGeoPoint.getLatitude(), 0.0001d);
assertEquals(calculatedGeoPoint.getLongitude(),testGeoPoint.getLongitude(), 0.0001d);


}

}

0 comments on commit 0dd449f

Please sign in to comment.