### Question:
TaskRestService extends RestServiceBase { @GET @Path("/type") @Produces(MediaType.APPLICATION_JSON) @AuditIgnore public Object getTypes() { return taskService.getTaskManager().listSupportedTaskTypes(); }  @GET @Path("/type") @Produces(MediaType.APPLICATION_JSON) @AuditIgnore Object getTypes(); @GET @Path("/task") @Produces(MediaType.APPLICATION_JSON) @AuditIgnore Object getTasks(@QueryParam("taskType") String taskType, @QueryParam("taskStatus") String[] taskStatus,
						   @QueryParam("from") Integer from, @QueryParam("size") Integer size); @GET @Path("/task/{taskId}") @Produces(MediaType.APPLICATION_JSON) @AuditIgnore Object getTask(@PathParam("taskId") String taskId); @POST @Path("/task/{taskType}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Object createTask(@PathParam("taskType") @AuditId String taskType, @AuditContent Map<String, Object> content); @DELETE @Path("/task/{taskId}") @Produces(MediaType.APPLICATION_JSON) Object cancelTask(@PathParam("taskId") @AuditId String id);  }### Answer:
@Test public void getTypes() { TaskRestService tested = getTested(); TaskManager managerMock = mockTaskManager(tested); List<String> value = new ArrayList<String>(); Mockito.when(managerMock.listSupportedTaskTypes()).thenReturn(value); Assert.assertEquals(value, tested.getTypes()); Mockito.verify(managerMock).listSupportedTaskTypes(); }
@Test(expected = RuntimeException.class) public void getTypes_errorFromSerice() { TaskRestService tested = getTested(); TaskManager managerMock = mockTaskManager(tested); Mockito.reset(managerMock); Mockito.when(managerMock.listSupportedTaskTypes()).thenThrow(new RuntimeException("test exception")); TestUtils.assertResponseStatus(tested.getTypes(), Status.INTERNAL_SERVER_ERROR); }