@Test public void create() throws Exception { when(eventOperationsService.createEvent("STUDY_CREATION", SECURE_USER)).thenReturn(CREATE_EVENT); studyTrackingOperationService.create(STUDY, SECURE_USER); verify(eventOperationsService, times(1)).createEvent("STUDY_CREATION", SECURE_USER); assertThat(STUDY.getEvents()).hasSize(1); assertThat(STUDY.getEvents()).extracting(event -> event.getUser().getEmail()).contains("test@test.com"); assertThat(STUDY.getEvents()).extracting(event -> event.getEventType()).contains("STUDY_CREATION"); assertThat(STUDY.getEvents()).extracting(event -> event.getEventDate()).isNotNull(); }
@Override public void create(Trackable trackable, SecureUser secureUser) { Event studyCreationEvent = eventOperationsService.createEvent("STUDY_CREATION", secureUser); trackable.addEvent(studyCreationEvent); }
StudyTrackingOperationServiceImpl implements TrackingOperationService { @Override public void create(Trackable trackable, SecureUser secureUser) { Event studyCreationEvent = eventOperationsService.createEvent("STUDY_CREATION", secureUser); trackable.addEvent(studyCreationEvent); } }
StudyTrackingOperationServiceImpl implements TrackingOperationService { @Override public void create(Trackable trackable, SecureUser secureUser) { Event studyCreationEvent = eventOperationsService.createEvent("STUDY_CREATION", secureUser); trackable.addEvent(studyCreationEvent); } @Autowired  StudyTrackingOperationServiceImpl(EventOperationsService eventOperationsService); }
StudyTrackingOperationServiceImpl implements TrackingOperationService { @Override public void create(Trackable trackable, SecureUser secureUser) { Event studyCreationEvent = eventOperationsService.createEvent("STUDY_CREATION", secureUser); trackable.addEvent(studyCreationEvent); } @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 create(Trackable trackable, SecureUser secureUser) { Event studyCreationEvent = eventOperationsService.createEvent("STUDY_CREATION", secureUser); trackable.addEvent(studyCreationEvent); } @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);  }