AdminResource { @GET @Path("/task/{tasktype}") @ApiOperation("Get the list of pending tasks for a given task type") @Consumes({ MediaType.WILDCARD }) public List<Task> view(@PathParam("tasktype") String taskType, @DefaultValue("0") @QueryParam("start") Integer start, @DefaultValue("100") @QueryParam("count") Integer count) { return adminService.getListOfPendingTask(taskType, start, count); } @Inject  AdminResource(AdminService adminService); @ApiOperation(value = "Get all the configuration parameters") @GET @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.APPLICATION_JSON) @Path("/config") Map<String, Object> getAllConfig(); @GET @Path("/task/{tasktype}") @ApiOperation("Get the list of pending tasks for a given task type") @Consumes({ MediaType.WILDCARD }) List<Task> view(@PathParam("tasktype") String taskType,
                           @DefaultValue("0") @QueryParam("start") Integer start,
                           @DefaultValue("100") @QueryParam("count") Integer count); @POST @Path("/sweep/requeue/{workflowId}") @ApiOperation("Queue up all the running workflows for sweep") @Consumes({ MediaType.WILDCARD }) @Produces({ MediaType.TEXT_PLAIN }) String requeueSweep(@PathParam("workflowId") String workflowId); @POST @Path("/consistency/verifyAndRepair/{workflowId}") @ApiOperation("Verify and repair workflow consistency") @Consumes({ MediaType.WILDCARD }) @Produces({ MediaType.TEXT_PLAIN }) String verifyAndRepairWorkflowConsistency(@PathParam("workflowId") String workflowId);  }
@Test public void testView() throws Exception { Task task = new Task(); task.setReferenceTaskName("test"); List<Task> listOfTask = new ArrayList<>(); listOfTask.add(task); when(mockAdminService.getListOfPendingTask(anyString(), anyInt(), anyInt())).thenReturn(listOfTask); assertEquals(listOfTask, adminResource.view("testTask", 0, 100)); }