/** * Test the three parameter {@code setConfiguration} method when the meters per pixel parameter has been changed. */ @Test public void testSetConfiguration_ThreeParameter_MetersPerPixelUpdate() { // Mocked objects facilitating testing double minLat = 10.0; double deltaLat = 1.0; double minLon = -95.0; double deltaLon = 2.0; Sector initialSector = new Sector(minLat, minLon, deltaLat, deltaLon); String initialNotionalServiceAddress = "notionalServiceAddress"; String initialNotionalLayerList = "notionalLayerList"; WmsLayerConfig initialWmsLayerConfig = new WmsLayerConfig(initialNotionalServiceAddress, initialNotionalLayerList); double metersPerPixel = 0.5; WmsLayer wmsLayer = new WmsLayer(initialSector, metersPerPixel, initialWmsLayerConfig); double alternativeMetersPerPixel = 10.0; int originalNumberOfLevels = ((TiledSurfaceImage) wmsLayer.getRenderable(0)).getLevelSet().numLevels(); wmsLayer.setConfiguration(initialSector, alternativeMetersPerPixel, initialWmsLayerConfig); int numberOfLevels = ((TiledSurfaceImage) wmsLayer.getRenderable(0)).getLevelSet().numLevels(); // assertEquals is not used as the determination of the number of levels is a function of LevelSetConfig assertFalse("levels updated", originalNumberOfLevels == numberOfLevels); }
assertEquals("detail levels", anticipatedLevels, ((TiledSurfaceImage) wmsLayer.getRenderable(0)).getLevelSet().numLevels());
/** * Test the four parameter {@code setConfiguration} method updates when the meters per pixel is changed. */ @Test public void testSetConfiguration_FourParameter_MetersPerPixelUpdate() { // Mocked objects facilitating testing double minLat = 10.0; double deltaLat = 1.0; double minLon = -95.0; double deltaLon = 2.0; double notionalGlobeRadius = 3000000.0; Sector initialSector = new Sector(minLat, minLon, deltaLat, deltaLon); Globe initialGlobe = PowerMockito.mock(Globe.class); PowerMockito.when(initialGlobe.getEquatorialRadius()).thenReturn(notionalGlobeRadius); String initialNotionalServiceAddress = "notionalServiceAddress"; String initialNotionalLayerList = "notionalLayerList"; WmsLayerConfig initialWmsLayerConfig = new WmsLayerConfig(initialNotionalServiceAddress, initialNotionalLayerList); double metersPerPixel = 0.5; WmsLayer wmsLayer = new WmsLayer(initialSector, initialGlobe, metersPerPixel, initialWmsLayerConfig); double alternativeMetersPerPixel = 10.0; int originalNumberOfLevels = ((TiledSurfaceImage) wmsLayer.getRenderable(0)).getLevelSet().numLevels(); wmsLayer.setConfiguration(initialSector, initialGlobe, alternativeMetersPerPixel, initialWmsLayerConfig); int numberOfLevels = ((TiledSurfaceImage) wmsLayer.getRenderable(0)).getLevelSet().numLevels(); assertFalse("levels updated", originalNumberOfLevels == numberOfLevels); } }
/** * Test the four parameter {@code setConfiguration} method updates when the {@link Globe} is changed. */ @Test public void testSetConfiguration_FourParameter_GlobeUpdate() { // Mocked objects facilitating testing double minLat = 10.0; double deltaLat = 1.0; double minLon = -95.0; double deltaLon = 2.0; double notionalGlobeRadius = 3000000.0; Sector initialSector = new Sector(minLat, minLon, deltaLat, deltaLon); Globe initialGlobe = PowerMockito.mock(Globe.class); PowerMockito.when(initialGlobe.getEquatorialRadius()).thenReturn(notionalGlobeRadius); String initialNotionalServiceAddress = "notionalServiceAddress"; String initialNotionalLayerList = "notionalLayerList"; WmsLayerConfig initialWmsLayerConfig = new WmsLayerConfig(initialNotionalServiceAddress, initialNotionalLayerList); double metersPerPixel = 0.5; WmsLayer wmsLayer = new WmsLayer(initialSector, initialGlobe, metersPerPixel, initialWmsLayerConfig); int initialLayers = ((TiledSurfaceImage) wmsLayer.getRenderable(0)).getLevelSet().numLevels(); Globe alternativeGlobe = PowerMockito.mock(Globe.class); PowerMockito.when(alternativeGlobe.getEquatorialRadius()).thenReturn(2 * notionalGlobeRadius); wmsLayer.setConfiguration(initialSector, alternativeGlobe, metersPerPixel, initialWmsLayerConfig); int numberOfLevels = ((TiledSurfaceImage) wmsLayer.getRenderable(0)).getLevelSet().numLevels(); assertFalse("layer levels updated by globe object change", initialLayers == numberOfLevels); }
/** * Test the three parameter {@code setConfiguration} method updates when the {@link Sector} is changed. */ @Test public void testSetConfiguration_ThreeParameter_SectorUpdate() { // Mocked objects facilitating testing double minLat = 10.0; double deltaLat = 1.0; double minLon = -95.0; double deltaLon = 2.0; Sector initialSector = new Sector(minLat, minLon, deltaLat, deltaLon); String initialNotionalServiceAddress = "notionalServiceAddress"; String initialNotionalLayerList = "notionalLayerList"; WmsLayerConfig initialWmsLayerConfig = new WmsLayerConfig(initialNotionalServiceAddress, initialNotionalLayerList); double metersPerPixel = 0.5; WmsLayer wmsLayer = new WmsLayer(initialSector, metersPerPixel, initialWmsLayerConfig); double alternativeLatMin = -45.0; double alternativeLonMin = 50.0; double alternativeDeltaLat = 5.0; double alternativeDeltaLon = 2.0; Sector alternativeSector = new Sector(alternativeLatMin, alternativeLonMin, alternativeDeltaLat, alternativeDeltaLon); wmsLayer.setConfiguration(alternativeSector, metersPerPixel, initialWmsLayerConfig); Sector sector = ((TiledSurfaceImage) wmsLayer.getRenderable(0)).getLevelSet().sector; assertEquals("sector updated", alternativeSector, sector); }
/** * Test the four parameter {@code setConfiguration} method updates when the {@link Sector} is changed. */ @Test public void testSetConfiguration_FourParameter_SectorUpdate() { // Mocked objects facilitating testing double minLat = 10.0; double deltaLat = 1.0; double minLon = -95.0; double deltaLon = 2.0; double notionalGlobeRadius = 3000000.0; Sector initialSector = new Sector(minLat, minLon, deltaLat, deltaLon); Globe initialGlobe = PowerMockito.mock(Globe.class); PowerMockito.when(initialGlobe.getEquatorialRadius()).thenReturn(notionalGlobeRadius); String initialNotionalServiceAddress = "notionalServiceAddress"; String initialNotionalLayerList = "notionalLayerList"; WmsLayerConfig initialWmsLayerConfig = new WmsLayerConfig(initialNotionalServiceAddress, initialNotionalLayerList); double metersPerPixel = 0.5; WmsLayer wmsLayer = new WmsLayer(initialSector, initialGlobe, metersPerPixel, initialWmsLayerConfig); double alternativeLatMin = -45.0; double alternativeLonMin = 50.0; double alternativeDeltaLat = 5.0; double alternativeDeltaLon = 2.0; Sector alternativeSector = new Sector(alternativeLatMin, alternativeLonMin, alternativeDeltaLat, alternativeDeltaLon); wmsLayer.setConfiguration(alternativeSector, initialGlobe, metersPerPixel, initialWmsLayerConfig); Sector sector = ((TiledSurfaceImage) wmsLayer.getRenderable(0)).getLevelSet().sector; assertEquals("sector updated", alternativeSector, sector); }