@Test public void update() throws Exception { when(eventOperationsService.createEvent("STUDY_STATUS_CHANGE_LEVEL_1_CURATION_DONE", SECURE_USER)).thenReturn(STATUS_EVENT); when(eventOperationsService.createEvent("STUDY_UPDATE", SECURE_USER)).thenReturn(UPDATE_EVENT); studyTrackingOperationService.update(STUDY, SECURE_USER, "STUDY_STATUS_CHANGE_LEVEL_1_CURATION_DONE"); studyTrackingOperationService.update(STUDY, SECURE_USER, "STUDY_UPDATE"); verify(eventOperationsService, times(1)).createEvent("STUDY_STATUS_CHANGE_LEVEL_1_CURATION_DONE", SECURE_USER); verify(eventOperationsService, times(1)).createEvent("STUDY_UPDATE", SECURE_USER); assertThat(STUDY.getEvents()).hasSize(2); assertThat(STUDY.getEvents()).extracting(event -> event.getUser().getEmail()).containsOnly("test@test.com"); assertThat(STUDY.getEvents()).extracting(event -> event.getEventType()) .containsOnly("STUDY_STATUS_CHANGE_LEVEL_1_CURATION_DONE", "STUDY_UPDATE"); assertThat(STUDY.getEvents()).extracting(event -> event.getEventDate()).isNotNull(); }
@Override public void update(Trackable trackable, SecureUser secureUser, String eventType) { Event updateEvent = eventOperationsService.createEvent(eventType, secureUser); trackable.addEvent(updateEvent); }
StudyTrackingOperationServiceImpl implements TrackingOperationService { @Override public void update(Trackable trackable, SecureUser secureUser, String eventType) { Event updateEvent = eventOperationsService.createEvent(eventType, secureUser); trackable.addEvent(updateEvent); } }
StudyTrackingOperationServiceImpl implements TrackingOperationService { @Override public void update(Trackable trackable, SecureUser secureUser, String eventType) { Event updateEvent = eventOperationsService.createEvent(eventType, secureUser); trackable.addEvent(updateEvent); } @Autowired  StudyTrackingOperationServiceImpl(EventOperationsService eventOperationsService); }
StudyTrackingOperationServiceImpl implements TrackingOperationService { @Override public void update(Trackable trackable, SecureUser secureUser, String eventType) { Event updateEvent = eventOperationsService.createEvent(eventType, secureUser); trackable.addEvent(updateEvent); } @Autowired  StudyTrackingOperationServiceImpl(EventOperationsService eventOperationsService); @Override void create(Trackable trackable, SecureUser secureUser); @Override void update(Trackable trackable, SecureUser secureUser, String eventType); @Override void update(Trackable trackable, SecureUser secureUser, String eventType, String description); @Override void delete(Trackable trackable, SecureUser secureUser); }
StudyTrackingOperationServiceImpl implements TrackingOperationService { @Override public void update(Trackable trackable, SecureUser secureUser, String eventType) { Event updateEvent = eventOperationsService.createEvent(eventType, secureUser); trackable.addEvent(updateEvent); } @Autowired  StudyTrackingOperationServiceImpl(EventOperationsService eventOperationsService); @Override void create(Trackable trackable, SecureUser secureUser); @Override void update(Trackable trackable, SecureUser secureUser, String eventType); @Override void update(Trackable trackable, SecureUser secureUser, String eventType, String description); @Override void delete(Trackable trackable, SecureUser secureUser);  }