@Test
public void testNPELayerBounds() throws IOException {

    MapLayer mapLayerBoundsNull = new MapLayer(new Layer() {
        public ReferencedEnvelope getBounds() {
            return null;
        }
    });
    DefaultMapContext mapContext = new DefaultMapContext(DefaultGeographicCRS.WGS84);
    mapContext.addLayer(mapLayerBoundsNull);
    ReferencedEnvelope layerBounds = mapContext.getLayerBounds();
    assertNull(layerBounds);
    
    ReferencedEnvelope maxBounds = mapContext.getMaxBounds();
    assertNotNull(maxBounds);
    assertEquals( DefaultGeographicCRS.WGS84, maxBounds.getCoordinateReferenceSystem() );
    assertTrue( maxBounds.isEmpty() );
    
}