### Question:
DeploymentGroupResource { @DELETE @Path("/{name}") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered public Response removeDeploymentGroup(@PathParam("name") @Valid final String name) { try { model.removeDeploymentGroup(name); return Response.ok(new RemoveDeploymentGroupResponse( RemoveDeploymentGroupResponse.Status.REMOVED)).build(); } catch (final DeploymentGroupDoesNotExistException e) { return Response.ok(new RemoveDeploymentGroupResponse( RemoveDeploymentGroupResponse.Status.DEPLOYMENT_GROUP_NOT_FOUND)).build(); } } DeploymentGroupResource(final MasterModel model); @POST @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response createDeploymentGroup(@Valid final DeploymentGroup deploymentGroup); @GET @Path("/{name}") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response getDeploymentGroup(@PathParam("name") final String name); @GET @Produces(APPLICATION_JSON) @Timed @ExceptionMetered List<String> getDeploymentGroup(); @DELETE @Path("/{name}") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response removeDeploymentGroup(@PathParam("name") @Valid final String name); @POST @Path("/{name}/rolling-update") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response rollingUpdate(@PathParam("name") @Valid final String name,
                                @Valid final RollingUpdateRequest args); @POST @Path("/{name}/stop") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response stopDeploymentGroup(@PathParam("name") @Valid final String name); @GET @Path("/{name}/status") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered Response getDeploymentGroupStatus(@PathParam("name") @Valid final String name);  }### Answer:
@Test public void testRemoveDeploymentGroup() throws Exception { final Response response = resource.removeDeploymentGroup("foo"); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); assertEquals(new RemoveDeploymentGroupResponse( RemoveDeploymentGroupResponse.Status.REMOVED), response.getEntity()); }
@Test public void testRemoveNonExistingDeploymentGroup() throws Exception { doThrow(new DeploymentGroupDoesNotExistException("")).when(model) .removeDeploymentGroup(anyString()); final Response response = resource.removeDeploymentGroup("foo"); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); assertEquals(new RemoveDeploymentGroupResponse( RemoveDeploymentGroupResponse.Status.DEPLOYMENT_GROUP_NOT_FOUND), response.getEntity()); }