### Question:
DeploymentGroupResource { @POST @Path("/{name}/rolling-update") @Produces(APPLICATION_JSON) @Timed @ExceptionMetered public Response rollingUpdate(@PathParam("name") @Valid final String name, @Valid final RollingUpdateRequest args) { try { final DeploymentGroup deploymentGroup = model.getDeploymentGroup(name); model.rollingUpdate(deploymentGroup, args.getJob(), args.getRolloutOptions()); return Response.ok(new RollingUpdateResponse(RollingUpdateResponse.Status.OK)).build(); } catch (DeploymentGroupDoesNotExistException e) { return Response.ok(new RollingUpdateResponse( RollingUpdateResponse.Status.DEPLOYMENT_GROUP_NOT_FOUND)).build(); } catch (JobDoesNotExistException e) { return Response.ok(new RollingUpdateResponse( RollingUpdateResponse.Status.JOB_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 testRollingUpdateDeploymentGroupDoesNotExist() throws Exception { doThrow(new DeploymentGroupDoesNotExistException("")).when(model).rollingUpdate( any(DeploymentGroup.class), any(JobId.class), any(RolloutOptions.class)); final Response response = resource.rollingUpdate( "foo", new RollingUpdateRequest(new JobId("foo", "0.3", "1234"), RolloutOptions.getDefault())); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); assertEquals(new RollingUpdateResponse(RollingUpdateResponse.Status.DEPLOYMENT_GROUP_NOT_FOUND), response.getEntity()); }
@Test public void testRollingUpdateJobDoesNotExist() throws Exception { doThrow(new JobDoesNotExistException("")).when(model).rollingUpdate( any(DeploymentGroup.class), any(JobId.class), any(RolloutOptions.class)); final Response response = resource.rollingUpdate( "foo", new RollingUpdateRequest(new JobId("foo", "0.3", "1234"), RolloutOptions.getDefault())); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); assertEquals(new RollingUpdateResponse(RollingUpdateResponse.Status.JOB_NOT_FOUND), response.getEntity()); }