feat(event): Add unregisterAll method to EventService and EventHandlerRegistry
This commit is contained in:
@@ -107,6 +107,21 @@ class EventServiceTest {
|
||||
.untilAsserted(() -> assertThat(this.receivedEvents).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUnregisterAll() throws InterruptedException {
|
||||
this.eventService.register(TestEvent.class, "consumer1", event -> this.receivedEvents.add(event));
|
||||
this.eventService.register(OtherTestEvent.class, "consumer1", event -> this.receivedEvents.add(event));
|
||||
|
||||
this.eventService.unregisterAll("consumer1");
|
||||
|
||||
this.eventService.fire(new TestEvent("test"));
|
||||
this.eventService.fire(new OtherTestEvent("other"));
|
||||
|
||||
await().pollDelay(Duration.ofMillis(50))
|
||||
.atMost(Duration.ofMillis(200))
|
||||
.untilAsserted(() -> assertThat(this.receivedEvents).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testConsumerReregistration() throws InterruptedException {
|
||||
final var firstLatch = new CountDownLatch(1);
|
||||
|
||||
Reference in New Issue
Block a user