@@ -34,11 +34,28 @@ public void testLat() {
34
34
assertThat (latToSphericalMercator (GeoTileUtils .LATITUDE_MASK ), Matchers .closeTo (MERCATOR_BOUNDS , 1e-7 ));
35
35
assertThat (latToSphericalMercator (-GeoTileUtils .LATITUDE_MASK ), Matchers .closeTo (-MERCATOR_BOUNDS , 1e-7 ));
36
36
assertThat (latToSphericalMercator (0.0 ), Matchers .closeTo (0 , 1e-7 ));
37
- final double lat = latToSphericalMercator (
38
- randomValueOtherThanMany (l -> l >= GeoTileUtils .LATITUDE_MASK || l <= -GeoTileUtils .LATITUDE_MASK , GeometryTestUtils ::randomLat )
39
- );
40
- assertThat (lat , Matchers .greaterThanOrEqualTo (-MERCATOR_BOUNDS ));
41
- assertThat (lat , Matchers .lessThanOrEqualTo (MERCATOR_BOUNDS ));
37
+ {
38
+ final double lat = latToSphericalMercator (
39
+ randomValueOtherThanMany (
40
+ l -> l >= GeoTileUtils .LATITUDE_MASK || l <= -GeoTileUtils .LATITUDE_MASK ,
41
+ GeometryTestUtils ::randomLat
42
+ )
43
+ );
44
+ assertThat (lat , Matchers .greaterThanOrEqualTo (-MERCATOR_BOUNDS ));
45
+ assertThat (lat , Matchers .lessThanOrEqualTo (MERCATOR_BOUNDS ));
46
+ }
47
+ {
48
+ // out of bounds values
49
+ final double lat = latToSphericalMercator (randomDoubleBetween (GeoTileUtils .LATITUDE_MASK , 90 , false ));
50
+ assertThat (lat , Matchers .greaterThan (MERCATOR_BOUNDS ));
51
+ assertTrue (Double .isFinite (latToSphericalMercator (90 )));
52
+ }
53
+ {
54
+ // out of bounds values
55
+ final double lat = latToSphericalMercator (-randomDoubleBetween (GeoTileUtils .LATITUDE_MASK , 90 , false ));
56
+ assertThat (lat , Matchers .lessThan (-MERCATOR_BOUNDS ));
57
+ assertTrue (Double .isFinite (latToSphericalMercator (-90 )));
58
+ }
42
59
}
43
60
44
61
public void testRectangle () {
0 commit comments