@Test
void flushEvents()
{

    this.eventManager.shouldStack(true);
    this.eventManager.notifyComponentRegistered(this.descriptor1);
    this.eventManager.notifyComponentRegistered(this.descriptor1, this.componentManager);
    this.eventManager.notifyComponentUnregistered(this.descriptor2);
    this.eventManager.notifyComponentUnregistered(this.descriptor2, this.componentManager);
    ComponentDescriptorAddedEvent addedEvent =
        new ComponentDescriptorAddedEvent(this.descriptor1.getRoleType(), this.descriptor1.getRoleHint());
    ComponentDescriptorRemovedEvent removedEvent =
        new ComponentDescriptorRemovedEvent(this.descriptor2.getRoleType(), this.descriptor2.getRoleHint());
    this.eventManager.flushEvents();
    verify(this.observationManager, times(1)).notify(eq(addedEvent), same(this.componentManager),
        same(this.descriptor1));
    verify(this.observationManager, times(1)).notify(eq(addedEvent), eq(null), same(this.descriptor1));
    verify(this.observationManager, times(1)).notify(eq(removedEvent), same(this.componentManager),
        same(this.descriptor2));
    verify(this.observationManager, times(1)).notify(eq(removedEvent), eq(null), same(this.descriptor2));
}