SingleLayerMapContent extends MapContent { @Override public boolean removeLayer(Layer layer) { throw new UnsupportedOperationException("Should not be called"); } SingleLayerMapContent(Layer layer); @Override boolean addLayer(Layer layer); @Override void moveLayer(int sourcePosition, int destPosition); @Override boolean removeLayer(Layer layer); @Override void dispose();  }
@Test(expected=UnsupportedOperationException.class) public void removeLayerThrowsException() { Layer layer = new MockLayer(WORLD); MapContent mc = new SingleLayerMapContent(layer); mc.removeLayer(layer); }