Skip to content

Commit

Permalink
[Enhancement kbss-cvut/termit-ui#520] Fix removePublishesEventAndDrop…
Browse files Browse the repository at this point in the history
…sGraph test
  • Loading branch information
lukaskabc committed Nov 5, 2024
1 parent bd29968 commit cb5c227
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import cz.cvut.kbss.termit.event.AssetPersistEvent;
import cz.cvut.kbss.termit.event.AssetUpdateEvent;
import cz.cvut.kbss.termit.event.RefreshLastModifiedEvent;
import cz.cvut.kbss.termit.event.VocabularyEvent;
import cz.cvut.kbss.termit.event.VocabularyWillBeRemovedEvent;
import cz.cvut.kbss.termit.model.Glossary;
import cz.cvut.kbss.termit.model.Model;
Expand Down Expand Up @@ -761,10 +762,14 @@ void removePublishesEventAndDropsGraph() {

transactional(() -> sut.remove(vocabulary));

ArgumentCaptor<VocabularyWillBeRemovedEvent> eventCaptor = ArgumentCaptor.forClass(VocabularyWillBeRemovedEvent.class);
verify(eventPublisher).publishEvent(eventCaptor.capture());
ArgumentCaptor<VocabularyEvent> eventCaptor = ArgumentCaptor.forClass(VocabularyWillBeRemovedEvent.class);
verify(eventPublisher, atLeastOnce()).publishEvent(eventCaptor.capture());

VocabularyWillBeRemovedEvent event = eventCaptor.getValue();
VocabularyWillBeRemovedEvent event = (VocabularyWillBeRemovedEvent) eventCaptor
.getAllValues().stream()
.filter(e -> e instanceof VocabularyWillBeRemovedEvent)
.findAny().orElseThrow();

assertNotNull(event);

assertEquals(event.getVocabularyIri(), vocabulary.getUri());
Expand Down

0 comments on commit cb5c227

Please sign in to comment.