### Question:
DataStorageEventService implements EntityEventService { @Override public void updateEventsWithChildrenAndIssues(final Long id) { AbstractDataStorage dataStorage = dataStorageManager.load(id); eventManager.addUpdateEventsForIssues(id, AclClass.DATA_STORAGE); eventManager.addUpdateEvent(dataStorage.getType().name(), id); }  @Override AclClass getSupportedClass(); @Override void updateEventsWithChildrenAndIssues(final Long id);  }### Answer:
@Test @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) public void shouldAddS3Event() { doNothing().when(entityManager).setManagers(anyListOf(SecuredEntityManager.class)); when(issueManager.loadIssuesForEntity(any())) .thenReturn(Arrays.asList(Issue.builder().id(1L).build(), Issue.builder().id(2L).build())); when(dataStorageManager.load(1L)).thenReturn(new S3bucketDataStorage(1L, "", "")); doNothing().when(eventDao).insertUpdateEvent(anyString(), anyLong()); dataStorageEventService.updateEventsWithChildrenAndIssues(1L); verify(eventDao).insertUpdateEvent("S3", 1L); verify(eventDao).insertUpdateEvent(ISSUE, 1L); verify(eventDao).insertUpdateEvent(ISSUE, 2L); verifyNoMoreInteractions(eventDao); }
@Test @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) public void shouldAddNFSEvent() { doNothing().when(entityManager).setManagers(anyListOf(SecuredEntityManager.class)); when(issueManager.loadIssuesForEntity(any())) .thenReturn(Arrays.asList(Issue.builder().id(1L).build(), Issue.builder().id(2L).build())); when(dataStorageManager.load(1L)).thenReturn(new NFSDataStorage(1L, "", "")); doNothing().when(eventDao).insertUpdateEvent(anyString(), anyLong()); dataStorageEventService.updateEventsWithChildrenAndIssues(1L); verify(eventDao).insertUpdateEvent("NFS", 1L); verify(eventDao).insertUpdateEvent(ISSUE, 1L); verify(eventDao).insertUpdateEvent(ISSUE, 2L); verifyNoMoreInteractions(eventDao); }