ActivityController { @RequestMapping(value = "/activity/retry/{activityId}", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) public void retryTask(@PathVariable Long activityId) { Thread retryThread = new Thread(new Runnable() { @Override public void run() { taskTriggerHandler.retryTask(activityId); } }); retryThread.start(); } @Autowired  ActivityController(final TaskActivityService activityService, TriggerHandler taskTriggerHandler, TaskWebService taskWebService); @RequestMapping(value = "/activity", method = RequestMethod.GET) @ResponseBody List<TaskActivityDto> getRecentActivities(); @RequestMapping(value = "/activity/all", method = RequestMethod.GET) @ResponseBody TaskActivityRecords getAllActivities(GridSettings settings); @RequestMapping(value = "/activity/{taskId}", method = RequestMethod.GET) @ResponseBody TaskActivityRecords getTaskActivities(@PathVariable Long taskId, GridSettings settings); @RequestMapping(value = "/activity/{taskId}/{activityType}", method = RequestMethod.GET) @ResponseBody long getTaskActivityCount(@PathVariable Long taskId, @PathVariable String activityType); @RequestMapping(value = "/activity/{taskId}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) void deleteActivitiesForTask(@PathVariable Long taskId); @RequestMapping(value = "/activity/retry/{activityId}", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) void retryTask(@PathVariable Long activityId); @RequestMapping(value = "/activity/retryMultiple", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) void retryMultipleTasks(@RequestBody List<Long> activityIds);  }
@Test public void shouldRetryTask() throws InterruptedException { controller.retryTask(ACTIVITY_ID); Thread.sleep(1000); verify(taskTriggerHandler).retryTask(ACTIVITY_ID); }