@Test public void delete() throws Exception { when(eventOperationsService.createEvent("ANCESTRY_DELETED", SECURE_USER)).thenReturn(DELETE_EVENT); trackingOperationService.delete(ANCESTRY, SECURE_USER); verify(eventOperationsService, times(1)).createEvent("ANCESTRY_DELETED", SECURE_USER); Assertions.assertThat(ANCESTRY.getEvents()).hasSize(1); Assertions.assertThat(ANCESTRY.getEvents()) .extracting(event -> event.getUser().getEmail()) .contains("test@test.com"); Assertions.assertThat(ANCESTRY.getEvents()) .extracting(event -> event.getEventType()) .contains("ANCESTRY_DELETED"); Assertions.assertThat(ANCESTRY.getEvents()).extracting(event -> event.getEventDate()).isNotNull(); }
@Override public void delete(Trackable trackable, SecureUser secureUser) { Event deleteEvent = eventOperationsService.createEvent("ANCESTRY_DELETED", secureUser); trackable.addEvent(deleteEvent); }
AncestryTrackingOperationServiceImpl implements TrackingOperationService { @Override public void delete(Trackable trackable, SecureUser secureUser) { Event deleteEvent = eventOperationsService.createEvent("ANCESTRY_DELETED", secureUser); trackable.addEvent(deleteEvent); } }
AncestryTrackingOperationServiceImpl implements TrackingOperationService { @Override public void delete(Trackable trackable, SecureUser secureUser) { Event deleteEvent = eventOperationsService.createEvent("ANCESTRY_DELETED", secureUser); trackable.addEvent(deleteEvent); } @Autowired  AncestryTrackingOperationServiceImpl(EventOperationsService eventOperationsService); }
AncestryTrackingOperationServiceImpl implements TrackingOperationService { @Override public void delete(Trackable trackable, SecureUser secureUser) { Event deleteEvent = eventOperationsService.createEvent("ANCESTRY_DELETED", secureUser); trackable.addEvent(deleteEvent); } @Autowired  AncestryTrackingOperationServiceImpl(EventOperationsService eventOperationsService); @Override void create(Trackable trackable, SecureUser secureUser); @Override void delete(Trackable trackable, SecureUser secureUser); @Override void update(Trackable trackable, SecureUser secureUser, String eventType); @Override void update(Trackable trackable, SecureUser secureUser, String eventType, String description); }
AncestryTrackingOperationServiceImpl implements TrackingOperationService { @Override public void delete(Trackable trackable, SecureUser secureUser) { Event deleteEvent = eventOperationsService.createEvent("ANCESTRY_DELETED", secureUser); trackable.addEvent(deleteEvent); } @Autowired  AncestryTrackingOperationServiceImpl(EventOperationsService eventOperationsService); @Override void create(Trackable trackable, SecureUser secureUser); @Override void delete(Trackable trackable, SecureUser secureUser); @Override void update(Trackable trackable, SecureUser secureUser, String eventType); @Override void update(Trackable trackable, SecureUser secureUser, String eventType, String description);  }