@Test public void shouldNotRemoveAnyActivitiesWhenTaskHasNotActivities() { when(taskActivitiesDataService.byTask(TASK_ID)).thenReturn(new ArrayList<TaskActivity>()); activityService.deleteActivitiesForTask(TASK_ID); verify(taskActivitiesDataService, never()).delete(any(TaskActivity.class)); }
@Test public void shouldDeleteAllTaskActivitiesForGivenTask() { when(taskActivitiesDataService.byTask(TASK_ID)).thenReturn(activities); activityService.deleteActivitiesForTask(TASK_ID); verify(taskActivitiesDataService, times(activities.size())).delete(any(TaskActivity.class)); }
@Test public void shouldReturnPaginatedActivitiesForGivenTask() { Set<TaskActivityType> types = new HashSet<>(); types.addAll(Arrays.asList(TaskActivityType.values())); QueryParams queryParams = new QueryParams((Order) null); when(taskActivitiesDataService.byTaskAndActivityTypes(TASK_ID, types, queryParams)) .thenReturn(activities); List<TaskActivity> actual = activityService.getTaskActivities(TASK_ID, types, queryParams); assertNotNull(actual); assertEquals(activities, actual); }