@Test public void updateClusterWithInvalidId() { Cluster updatedCluster = new Cluster("invalid", "Updated Cluster"); expectedEx.expect(EntityNotFoundException.class); expectedEx.expectMessage("Cluster with the specified ID not found: ID = " + updatedCluster.getId()); clusterService.updateCluster(updatedCluster.getId(), updatedCluster); }
public void updateCluster(String clusterId, Cluster cluster) { if (!clusters.containsKey(clusterId)) { throw new EntityNotFoundException( "Cluster with the specified ID not found: ID = " + clusterId); } clusters.put(clusterId, cluster); }
ClusterService { public void updateCluster(String clusterId, Cluster cluster) { if (!clusters.containsKey(clusterId)) { throw new EntityNotFoundException( "Cluster with the specified ID not found: ID = " + clusterId); } clusters.put(clusterId, cluster); } }
ClusterService { public void updateCluster(String clusterId, Cluster cluster) { if (!clusters.containsKey(clusterId)) { throw new EntityNotFoundException( "Cluster with the specified ID not found: ID = " + clusterId); } clusters.put(clusterId, cluster); } @Inject  ClusterService(StormEngine stormEngine, StreamflowConfig streamflowConfig); }
ClusterService { public void updateCluster(String clusterId, Cluster cluster) { if (!clusters.containsKey(clusterId)) { throw new EntityNotFoundException( "Cluster with the specified ID not found: ID = " + clusterId); } clusters.put(clusterId, cluster); } @Inject  ClusterService(StormEngine stormEngine, StreamflowConfig streamflowConfig); Collection<Cluster> listClusters(); Cluster addCluster(Cluster cluster); Cluster getCluster(String clusterId); void deleteCluster(String clusterId); void updateCluster(String clusterId, Cluster cluster); ClusterSummary getClusterSummary(String clusterId); }
ClusterService { public void updateCluster(String clusterId, Cluster cluster) { if (!clusters.containsKey(clusterId)) { throw new EntityNotFoundException( "Cluster with the specified ID not found: ID = " + clusterId); } clusters.put(clusterId, cluster); } @Inject  ClusterService(StormEngine stormEngine, StreamflowConfig streamflowConfig); Collection<Cluster> listClusters(); Cluster addCluster(Cluster cluster); Cluster getCluster(String clusterId); void deleteCluster(String clusterId); void updateCluster(String clusterId, Cluster cluster); ClusterSummary getClusterSummary(String clusterId);  }