@Test(expected = IllegalArgumentException.class) public void shouldNotBeAbleToAddCubeByStarredCubeId() throws Exception { String cubeId = "tomcat*"; Cube cube = createCubeMock(cubeId); cubeRegistry.addCube(cube); }
@Override public void addCube(Cube<?> cube) { CubeId cubeId = CubeIdFactory.get().create(cube.getId()); if (cubeId instanceof StarredCubeId) { throw new IllegalArgumentException("Starred cube id cannot be added."); } this.cubes.put(cubeId, cube); }
LocalCubeRegistry implements CubeRegistry { @Override public void addCube(Cube<?> cube) { CubeId cubeId = CubeIdFactory.get().create(cube.getId()); if (cubeId instanceof StarredCubeId) { throw new IllegalArgumentException("Starred cube id cannot be added."); } this.cubes.put(cubeId, cube); } }
LocalCubeRegistry implements CubeRegistry { @Override public void addCube(Cube<?> cube) { CubeId cubeId = CubeIdFactory.get().create(cube.getId()); if (cubeId instanceof StarredCubeId) { throw new IllegalArgumentException("Starred cube id cannot be added."); } this.cubes.put(cubeId, cube); } LocalCubeRegistry(); }
LocalCubeRegistry implements CubeRegistry { @Override public void addCube(Cube<?> cube) { CubeId cubeId = CubeIdFactory.get().create(cube.getId()); if (cubeId instanceof StarredCubeId) { throw new IllegalArgumentException("Starred cube id cannot be added."); } this.cubes.put(cubeId, cube); } 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 addCube(Cube<?> cube) { CubeId cubeId = CubeIdFactory.get().create(cube.getId()); if (cubeId instanceof StarredCubeId) { throw new IllegalArgumentException("Starred cube id cannot be added."); } this.cubes.put(cubeId, cube); } 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();  }