ReferenceUtils { public static boolean isShg(GridInfo info){ if(info.getGridType() != 420){ return false; } AlbersInfo albersInfo = (AlbersInfo) info; if(albersInfo.getFirstStandardParallel() != 29.5){ return false; } if(albersInfo.getSecondStandardParallel() != 45.5){ return false; } if(albersInfo.getLatitudeOfProjectionOrigin() != 23.0){ return false; } if(albersInfo.getCentralMeridian() != -96.0){ return false; } if(albersInfo.getFalseEasting() != 0){ return false; } if(albersInfo.getFalseNorthing() != 0){ return false; } if(albersInfo.getProjectionDatum() != GridInfo.getNad83()){ return false; } String units = albersInfo.getProjectionUnits().toLowerCase(); return units.equals("m") || units.equals("meter") || units.equals("meters") || units.equals("metre"); } private  ReferenceUtils(); static String enhanceWkt(String wkt); static String getMapUnits(String wkt); static int getUlyDirection(String wkt, double llx, double lly); static boolean compareSpatiallyEquivalent(VortexGrid grid1, VortexGrid grid2); static boolean isShg(GridInfo info);  }
@Test void IsShgReturnsTrueForShgWithProjectionUnitsM(){ AlbersInfo info = mock(AlbersInfo.class); when(info.getGridType()).thenReturn(420); when(info.getFirstStandardParallel()).thenReturn((float) 29.5); when(info.getSecondStandardParallel()).thenReturn((float) 45.5); when(info.getLatitudeOfProjectionOrigin()).thenReturn((float) 23.0); when(info.getCentralMeridian()).thenReturn((float) -96.0); when(info.getFalseEasting()).thenReturn((float) 0); when(info.getFalseNorthing()).thenReturn((float) 0); when(info.getProjectionDatum()).thenReturn(GridInfo.getNad83()); when(info.getProjectionUnits()).thenReturn("m"); assertTrue(ReferenceUtils.isShg(info)); }
@Test void IsShgReturnsTrueForShgWithProjectionUnitsMeter(){ AlbersInfo info = mock(AlbersInfo.class); when(info.getGridType()).thenReturn(420); when(info.getFirstStandardParallel()).thenReturn((float) 29.5); when(info.getSecondStandardParallel()).thenReturn((float) 45.5); when(info.getLatitudeOfProjectionOrigin()).thenReturn((float) 23.0); when(info.getCentralMeridian()).thenReturn((float) -96.0); when(info.getFalseEasting()).thenReturn((float) 0); when(info.getFalseNorthing()).thenReturn((float) 0); when(info.getProjectionDatum()).thenReturn(GridInfo.getNad83()); when(info.getProjectionUnits()).thenReturn("meter"); assertTrue(ReferenceUtils.isShg(info)); }
@Test void IsShgReturnsFalseForShgWithProjectionUnitsFeet(){ AlbersInfo info = mock(AlbersInfo.class); when(info.getGridType()).thenReturn(420); when(info.getFirstStandardParallel()).thenReturn((float) 29.5); when(info.getSecondStandardParallel()).thenReturn((float) 45.5); when(info.getLatitudeOfProjectionOrigin()).thenReturn((float) 23.0); when(info.getCentralMeridian()).thenReturn((float) -96.0); when(info.getFalseEasting()).thenReturn((float) 0); when(info.getFalseNorthing()).thenReturn((float) 0); when(info.getProjectionDatum()).thenReturn(GridInfo.getNad83()); when(info.getProjectionUnits()).thenReturn("ft"); assertFalse(ReferenceUtils.isShg(info)); }