AlertService { public void close(Action action) { repository.markAlertAsClosed(action.caseID(), action.get("visitCode"), action.get("completionDate")); } 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 shouldMarkAlertAsClosedInRepositoryForCloseActions() throws Exception { Action firstAction = actionForCloseAlert("Case X", "ANC 1", "2012-01-01", "0"); Action secondAction = actionForCloseAlert("Case Y", "ANC 2", "2012-01-01", "0"); service.close(firstAction); service.close(secondAction); verify(alertRepository).markAlertAsClosed("Case X", "ANC 1", "2012-01-01"); verify(alertRepository).markAlertAsClosed("Case Y", "ANC 2", "2012-01-01"); verifyNoMoreInteractions(alertRepository); }