@Test public void mapping() throws Exception { when(eventOperationsService.createEvent("ASSOCIATION_MAPPING", SECURE_USER)).thenReturn(MAPPING_EVENT); associationTrackingOperationService.update(ASSOCIATION, SECURE_USER,"ASSOCIATION_MAPPING"); assertThat(ASSOCIATION.getEvents()).hasSize(1); assertThat(ASSOCIATION.getEvents()).extracting(Event::getEventType) .containsOnly("ASSOCIATION_MAPPING"); assertThat(ASSOCIATION.getEvents()).extracting(event -> event.getUser().getEmail()) .containsOnly(SECURE_USER.getEmail()); assertThat(ASSOCIATION.getEvents()).extracting(Event::getEventDate).isNotNull(); verify(eventOperationsService, times(1)).createEvent("ASSOCIATION_MAPPING", SECURE_USER); }
@Override public void update(Trackable trackable, SecureUser secureUser,String eventType) { Event updateEvent = eventOperationsService.createEvent(eventType, secureUser); trackable.addEvent(updateEvent); }
AssociationTrackingOperationServiceImpl implements TrackingOperationService { @Override public void update(Trackable trackable, SecureUser secureUser,String eventType) { Event updateEvent = eventOperationsService.createEvent(eventType, secureUser); trackable.addEvent(updateEvent); } }
AssociationTrackingOperationServiceImpl implements TrackingOperationService { @Override public void update(Trackable trackable, SecureUser secureUser,String eventType) { Event updateEvent = eventOperationsService.createEvent(eventType, secureUser); trackable.addEvent(updateEvent); } @Autowired  AssociationTrackingOperationServiceImpl(EventOperationsService eventOperationsService); }
AssociationTrackingOperationServiceImpl implements TrackingOperationService { @Override public void update(Trackable trackable, SecureUser secureUser,String eventType) { Event updateEvent = eventOperationsService.createEvent(eventType, secureUser); trackable.addEvent(updateEvent); } @Autowired  AssociationTrackingOperationServiceImpl(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); }
AssociationTrackingOperationServiceImpl implements TrackingOperationService { @Override public void update(Trackable trackable, SecureUser secureUser,String eventType) { Event updateEvent = eventOperationsService.createEvent(eventType, secureUser); trackable.addEvent(updateEvent); } @Autowired  AssociationTrackingOperationServiceImpl(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);  }