### Question:
ClusterResource { @PUT @Path("/{clusterId}") @Consumes(MediaType.APPLICATION_JSON) public Response updateCluster(@PathParam("clusterId") String clusterId, Cluster cluster) { clusterService.updateCluster(clusterId, cluster); return Response.ok().build(); } @Inject  ClusterResource(ClusterService clusterService); @GET @Produces(MediaType.APPLICATION_JSON) Collection<Cluster> listClusters(); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Cluster createCluster(Cluster cluster); @GET @Path("/{clusterId}") @Produces(MediaType.APPLICATION_JSON) Cluster getCluster(@PathParam("clusterId") String clusterId); @PUT @Path("/{clusterId}") @Consumes(MediaType.APPLICATION_JSON) Response updateCluster(@PathParam("clusterId") String clusterId, Cluster cluster); @DELETE @Path("/{clusterId}") Response deleteCluster(@PathParam("clusterId") String clusterId); @GET @Path("/{clusterId}/summary") @Produces(MediaType.APPLICATION_JSON) ClusterSummary getClusterSummary(@PathParam("clusterId") String clusterId);  }### Answer:
@Test public void updateCluster() { final Cluster requestCluster = new Cluster("CLUSTER_TO_UPDATE", "Updated Cluster"); doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { String argClusterId = (String) invocation.getArguments()[0]; Cluster argCluster = (Cluster) invocation.getArguments()[1]; assertEquals("Service cluster ID should match the requested cluster ID", argClusterId, requestCluster.getId()); assertEquals("Service cluster should match the requested cluster", argCluster, requestCluster); return null; } }).when(clusterServiceMock).updateCluster(anyString(), any(Cluster.class)); ClientResponse clientResponse = resource().path("/api/clusters/" + requestCluster.getId()) .accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON) .put(ClientResponse.class, requestCluster); assertEquals("Response HTTP status code should be 200 (OK)", clientResponse.getStatus(), 200); verify(clusterServiceMock).updateCluster(anyString(), any(Cluster.class)); }