AlertService { public void deleteAll(Action action) { repository.deleteAllAlertsForEntity(action.caseID()); } AlertService(AlertRepository repository); void create(Action action); void close(Action action); void deleteAll(Action action); List<Alert> findByEntityIdAndAlertNames(String entityId, String... names); void changeAlertStatusToInProcess(String entityId, String alertName);  }
@Test public void shouldDeleteAllFromRepositoryForDeleteAllActions() throws Exception { Action firstAction = actionForDeleteAllAlert("Case X"); Action secondAction = actionForDeleteAllAlert("Case Y"); service.deleteAll(firstAction); service.deleteAll(secondAction); verify(alertRepository).deleteAllAlertsForEntity("Case X"); verify(alertRepository).deleteAllAlertsForEntity("Case Y"); verifyNoMoreInteractions(alertRepository); }