@Test public void shouldSaveTask() { String subject = "trigger1"; TaskActionInformation action = new TaskActionInformation("send", "action1", "action", "0.15", "send", new HashMap<String, String>()); TaskTriggerInformation trigger = new TaskTriggerInformation("trigger", "trigger1", "trigger", "0.16", subject, subject); Task expected = new Task("name", trigger, asList(action)); when(eventListenerRegistryService.getListeners(subject)).thenReturn(new HashSet<EventListener>()); controller.save(expected); verify(taskWebService).save(expected); }
@RequestMapping(value = "/task/save", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) @ResponseBody public Set<TaskErrorDto> save(@RequestBody Task task) { return taskWebService.save(task); }
TaskController { @RequestMapping(value = "/task/save", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) @ResponseBody public Set<TaskErrorDto> save(@RequestBody Task task) { return taskWebService.save(task); } }
TaskController { @RequestMapping(value = "/task/save", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) @ResponseBody public Set<TaskErrorDto> save(@RequestBody Task task) { return taskWebService.save(task); }  }
TaskController { @RequestMapping(value = "/task/save", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) @ResponseBody public Set<TaskErrorDto> save(@RequestBody Task task) { return taskWebService.save(task); }  @RequestMapping(value = "/task", method = RequestMethod.GET) @ResponseBody List<TaskDto> getAllTasks(); @RequestMapping(value = "/task/import", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) void importTask(@RequestParam(value = "file") MultipartFile file); @RequestMapping(value = "/task/{taskId}", method = RequestMethod.GET) @ResponseBody TaskDto getTask(@PathVariable Long taskId); @RequestMapping(value = "/task/{taskId}", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) @ResponseBody Set<TaskErrorDto> saveTask(@RequestBody Task task); @RequestMapping(value = "/task/enable-or-disable/{taskId}", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) @ResponseBody void setTaskEnabledOrDisabled(@RequestBody Task task); @RequestMapping(value = "/task/{taskId}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) void deleteTask(@PathVariable Long taskId); @RequestMapping(value = "/task/{taskId}/export", method = RequestMethod.GET) void exportTask(@PathVariable Long taskId, HttpServletResponse response); @RequestMapping(value = "/task/save", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) @ResponseBody Set<TaskErrorDto> save(@RequestBody Task task); @ExceptionHandler(ValidationException.class) @ResponseStatus(HttpStatus.NOT_FOUND) @ResponseBody Set<TaskErrorDto> handleException(ValidationException e); @ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.NOT_FOUND) @ResponseBody String handleException(Exception e); }
TaskController { @RequestMapping(value = "/task/save", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) @ResponseBody public Set<TaskErrorDto> save(@RequestBody Task task) { return taskWebService.save(task); }  @RequestMapping(value = "/task", method = RequestMethod.GET) @ResponseBody List<TaskDto> getAllTasks(); @RequestMapping(value = "/task/import", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) void importTask(@RequestParam(value = "file") MultipartFile file); @RequestMapping(value = "/task/{taskId}", method = RequestMethod.GET) @ResponseBody TaskDto getTask(@PathVariable Long taskId); @RequestMapping(value = "/task/{taskId}", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) @ResponseBody Set<TaskErrorDto> saveTask(@RequestBody Task task); @RequestMapping(value = "/task/enable-or-disable/{taskId}", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) @ResponseBody void setTaskEnabledOrDisabled(@RequestBody Task task); @RequestMapping(value = "/task/{taskId}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) void deleteTask(@PathVariable Long taskId); @RequestMapping(value = "/task/{taskId}/export", method = RequestMethod.GET) void exportTask(@PathVariable Long taskId, HttpServletResponse response); @RequestMapping(value = "/task/save", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) @ResponseBody Set<TaskErrorDto> save(@RequestBody Task task); @ExceptionHandler(ValidationException.class) @ResponseStatus(HttpStatus.NOT_FOUND) @ResponseBody Set<TaskErrorDto> handleException(ValidationException e); @ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.NOT_FOUND) @ResponseBody String handleException(Exception e);  }