SingleLayerMapContent extends MapContent { @Override public boolean addLayer(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 addLayerThrowsException() { Layer layer = new MockLayer(WORLD); MapContent mc = new SingleLayerMapContent(layer); Layer layer2 = new MockLayer(WORLD); mc.addLayer(layer2); }