Skip to content

Commit

Permalink
[Enhancement kbss-cvut/termit-ui#530] Fix removePublishesEventAndDrop…
Browse files Browse the repository at this point in the history
…sGraph test
  • Loading branch information
lukaskabc authored and ledsoft committed Nov 11, 2024
1 parent e331541 commit 44541bf
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 44541bf

Please sign in to comment.