@Test(expected = IllegalArgumentException.class) public void shouldNotBeAbleToRemoveCubeByStarredCubeId() throws Exception { String cubeId = "tomcat*"; cubeRegistry.removeCube(cubeId); }
@Override public void removeCube(String id) { CubeId cubeId = CubeIdFactory.get().create(id); if (cubeId instanceof StarredCubeId) { throw new IllegalArgumentException("Starred cube id cannot be removed."); } cubes.remove(cubeId); }
LocalCubeRegistry implements CubeRegistry { @Override public void removeCube(String id) { CubeId cubeId = CubeIdFactory.get().create(id); if (cubeId instanceof StarredCubeId) { throw new IllegalArgumentException("Starred cube id cannot be removed."); } cubes.remove(cubeId); } }
LocalCubeRegistry implements CubeRegistry { @Override public void removeCube(String id) { CubeId cubeId = CubeIdFactory.get().create(id); if (cubeId instanceof StarredCubeId) { throw new IllegalArgumentException("Starred cube id cannot be removed."); } cubes.remove(cubeId); } LocalCubeRegistry(); }
LocalCubeRegistry implements CubeRegistry { @Override public void removeCube(String id) { CubeId cubeId = CubeIdFactory.get().create(id); if (cubeId instanceof StarredCubeId) { throw new IllegalArgumentException("Starred cube id cannot be removed."); } cubes.remove(cubeId); } LocalCubeRegistry(); @Override void addCube(Cube<?> cube); @Override void removeCube(String id); @Override List<Cube<?>> getByMetadata(Class<? extends CubeMetadata> metadata); @Override Cube<?> getCube(String id); @Override T getCube(String id, Class<T> type); @Override List<Cube<?>> getCubes(); }
LocalCubeRegistry implements CubeRegistry { @Override public void removeCube(String id) { CubeId cubeId = CubeIdFactory.get().create(id); if (cubeId instanceof StarredCubeId) { throw new IllegalArgumentException("Starred cube id cannot be removed."); } cubes.remove(cubeId); } LocalCubeRegistry(); @Override void addCube(Cube<?> cube); @Override void removeCube(String id); @Override List<Cube<?>> getByMetadata(Class<? extends CubeMetadata> metadata); @Override Cube<?> getCube(String id); @Override T getCube(String id, Class<T> type); @Override List<Cube<?>> getCubes();  }