@Test public void shouldDeleteTask() { Task expected = new Task(); expected.setId(12345L); when(tasksDataService.findById(expected.getId())).thenReturn(expected); taskService.deleteTask(expected.getId()); verify(tasksDataService).findById(expected.getId()); verify(tasksDataService).delete(expected); }
@Override @Transactional public void deleteTask(Long taskId) { Task t = getTask(taskId); if (t == null) { throw new TaskNotFoundException(taskId); } LOGGER.info("Deleted task: {} with ID: {}", t.getName(), taskId); tasksDataService.delete(t); }
TaskServiceImpl implements TaskService { @Override @Transactional public void deleteTask(Long taskId) { Task t = getTask(taskId); if (t == null) { throw new TaskNotFoundException(taskId); } LOGGER.info("Deleted task: {} with ID: {}", t.getName(), taskId); tasksDataService.delete(t); } }
TaskServiceImpl implements TaskService { @Override @Transactional public void deleteTask(Long taskId) { Task t = getTask(taskId); if (t == null) { throw new TaskNotFoundException(taskId); } LOGGER.info("Deleted task: {} with ID: {}", t.getName(), taskId); tasksDataService.delete(t); }  }
TaskServiceImpl implements TaskService { @Override @Transactional public void deleteTask(Long taskId) { Task t = getTask(taskId); if (t == null) { throw new TaskNotFoundException(taskId); } LOGGER.info("Deleted task: {} with ID: {}", t.getName(), taskId); tasksDataService.delete(t); }  @Override @Transactional Set<TaskError> save(final Task task); @Override @Transactional void setEnabledOrDisabled(final Task task); @Override @Transactional ActionEvent getActionEventFor(TaskActionInformation taskActionInformation); @Override @Transactional List<Task> getAllTasks(); @Override @Transactional List<Task> findTasksByName(String name); @Override @Transactional List<Task> findActiveTasksForTrigger(final TriggerEvent trigger); @Override @Transactional List<Task> findActiveTasksForTriggerSubject(final String subject); @Override TasksEventParser findCustomParser(String name); @Override @Transactional Task getTask(Long taskId); @Override @Transactional void deleteTask(Long taskId); @MotechListener(subjects = CHANNEL_UPDATE_SUBJECT) @Transactional void validateTasksAfterChannelUpdate(MotechEvent event); @MotechListener(subjects = DATA_PROVIDER_UPDATE_SUBJECT) @Transactional void validateTasksAfterTaskDataProviderUpdate(MotechEvent event); @Override @Transactional String exportTask(Long taskId); @Override @Transactional Task importTask(String json); @Override @Transactional List<Task> findTasksDependentOnModule(final String moduleName); @Autowired void setTasksDataService(TasksDataService tasksDataService); @Autowired void setChannelService(ChannelService channelService); @Autowired void setProviderService(TaskDataProviderService providerService); @Autowired void setEventRelay(EventRelay eventRelay); @Autowired void setBundleContext(BundleContext bundleContext); @Autowired void setTaskValidator(TaskValidator taskValidator); @Autowired void setTriggerEventService(TriggerEventService triggerEventService); @Autowired void setTaskMigrationManager(TaskMigrationManager taskMigrationManager); }
TaskServiceImpl implements TaskService { @Override @Transactional public void deleteTask(Long taskId) { Task t = getTask(taskId); if (t == null) { throw new TaskNotFoundException(taskId); } LOGGER.info("Deleted task: {} with ID: {}", t.getName(), taskId); tasksDataService.delete(t); }  @Override @Transactional Set<TaskError> save(final Task task); @Override @Transactional void setEnabledOrDisabled(final Task task); @Override @Transactional ActionEvent getActionEventFor(TaskActionInformation taskActionInformation); @Override @Transactional List<Task> getAllTasks(); @Override @Transactional List<Task> findTasksByName(String name); @Override @Transactional List<Task> findActiveTasksForTrigger(final TriggerEvent trigger); @Override @Transactional List<Task> findActiveTasksForTriggerSubject(final String subject); @Override TasksEventParser findCustomParser(String name); @Override @Transactional Task getTask(Long taskId); @Override @Transactional void deleteTask(Long taskId); @MotechListener(subjects = CHANNEL_UPDATE_SUBJECT) @Transactional void validateTasksAfterChannelUpdate(MotechEvent event); @MotechListener(subjects = DATA_PROVIDER_UPDATE_SUBJECT) @Transactional void validateTasksAfterTaskDataProviderUpdate(MotechEvent event); @Override @Transactional String exportTask(Long taskId); @Override @Transactional Task importTask(String json); @Override @Transactional List<Task> findTasksDependentOnModule(final String moduleName); @Autowired void setTasksDataService(TasksDataService tasksDataService); @Autowired void setChannelService(ChannelService channelService); @Autowired void setProviderService(TaskDataProviderService providerService); @Autowired void setEventRelay(EventRelay eventRelay); @Autowired void setBundleContext(BundleContext bundleContext); @Autowired void setTaskValidator(TaskValidator taskValidator); @Autowired void setTriggerEventService(TriggerEventService triggerEventService); @Autowired void setTaskMigrationManager(TaskMigrationManager taskMigrationManager); static final List<String> IGNORED_FIELDS; }