TaskActivityServiceImpl implements TaskActivityService { @Override @Transactional public List<TaskActivity> getTaskActivities(Long taskId, Set<TaskActivityType> activityTypes, QueryParams queryParams, boolean lastExecution) { return taskActivitiesDataService.byTaskAndActivityTypesAndIds(taskId, activityTypes, getActivityIdsIfLastExecution(lastExecution, activityTypes), queryParams); } @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 shouldReturnPaginatedActivitiesForGivenTask() { Set<TaskActivityType> types = new HashSet<>(); types.addAll(Arrays.asList(TaskActivityType.values())); Set<Long> activitiesIds = new HashSet<>(); QueryParams queryParams = new QueryParams((Order) null); boolean lastExecution = false; when(taskActivitiesDataService.byTaskAndActivityTypesAndIds(TASK_ID, types, activitiesIds, queryParams)).thenReturn(activities); List<TaskActivity> actual = activityService.getTaskActivities(TASK_ID, types, queryParams, lastExecution); assertNotNull(actual); assertEquals(activities, actual); }