### Question:
PrefilteringLiveNotificationEmailManager implements Initializable, Disposable { public void addEvent(EntityEvent entityEvent) { if (!this.preQueue.add(entityEvent)) { this.logger.warn( "The event [{}] could not be added to the queue of live notification mails. " + "It generally means the queue was already full because more event are produced than sent.", entityEvent); } }  @Override void initialize(); @Override void dispose(); void addEvent(EntityEvent entityEvent); void addEvents(String wikiId);  }### Answer:
@Test void addEvent() throws InterruptedException { DocumentReference userReference = new DocumentReference("wiki", "XWiki", "user"); when(this.resolver.resolve("entity", null)).thenReturn(userReference); Event event = mock(Event.class); EntityEvent entityEvent = new DefaultEntityEvent(event, "entity"); when(this.intervals.getInterval(userReference)).thenReturn(NotificationEmailInterval.LIVE); this.manager.addEvent(entityEvent); Thread.sleep(100); verify(this.dispatcher, times(1)).addEvent(event, userReference); when(this.intervals.getInterval(userReference)).thenReturn(NotificationEmailInterval.DAILY); this.manager.addEvent(entityEvent); Thread.sleep(100); verify(this.dispatcher, times(1)).addEvent(event, userReference); }