TaskActivityServiceImpl implements TaskActivityService { @Override @Transactional(propagation = Propagation.REQUIRES_NEW) public void addTaskFiltered(Long activityId) { TaskActivity activity = taskActivitiesDataService.findById(activityId); activity.setActivityType(TaskActivityType.FILTERED); activity.setMessage(TASK_FILTERED); taskActivitiesDataService.update(activity); } @Autowired  TaskActivityServiceImpl(TaskActivitiesDataService taskActivitiesDataService); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) long addTaskStarted(Task task, Map<String, Object> parameters); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addTaskFiltered(Long activityId); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) boolean addSuccessfulExecution(Long activityId); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addFilteredExecution(Long activityId); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addFailedExecution(Long activityId, Throwable e); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addTaskDisabledWarning(Task task); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addWarning(Task task, String key, String field); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void addWarningWithException(Task task, String key, String field, Exception e); @Override @Transactional void deleteActivitiesForTask(Long taskId); @Override @Transactional TaskActivity getTaskActivityById(Long activityId); @Override @Transactional List<TaskActivity> getLatestActivities(); @Override @Transactional List<TaskActivity> getAllActivities(Set<TaskActivityType> activityTypes, QueryParams queryParams, boolean lastExecution); @Override @Transactional List<TaskActivity> getAllActivities(Set<TaskActivityType> activityTypes, Range<DateTime> dateRange,
                                               QueryParams queryParams, boolean lastExecution); @Override @Transactional List<TaskActivity> getTaskActivities(Long taskId, Set<TaskActivityType> activityTypes, QueryParams queryParams, boolean lastExecution); @Override @Transactional List<TaskActivity> getTaskActivities(Long taskId, Set<TaskActivityType> activityTypes, Range<DateTime> dateRange,
                                                QueryParams queryParams, boolean lastExecution); @Override @Transactional long getTaskActivitiesCount(Long taskId, Set<TaskActivityType> activityTypes, boolean lastExecution); @Override @Transactional long getTaskActivitiesCount(Long taskId, TaskActivityType type); @Override @Transactional long getTaskActivitiesCount(Long taskId, Set<TaskActivityType> activityTypes, Range<DateTime> dateRange, boolean lastExecution); @Override @Transactional long getAllTaskActivitiesCount(Set<TaskActivityType> activityTypes, boolean lastExecution); @Override @Transactional long getAllTaskActivitiesCount(Set<TaskActivityType> activityTypes, Range<DateTime> dateRange, boolean lastExecution);  }
@Test public void shouldAddTaskFilteredActivity() { when(taskActivitiesDataService.findById(TASK_ACTIVITY_ID)).thenReturn(createInProgress()); String messageKey = "task.filtered"; ArgumentCaptor<TaskActivity> captor = ArgumentCaptor.forClass(TaskActivity.class); activityService.addTaskFiltered(TASK_ACTIVITY_ID); verify(taskActivitiesDataService).findById(TASK_ACTIVITY_ID); verify(taskActivitiesDataService).update(captor.capture()); assertActivity(messageKey, Collections.<String>emptyList(), TASK_ID, TaskActivityType.FILTERED, null, null, captor.getValue()); }