use of org.xwiki.eventstream.internal.DefaultEvent in project xwiki-platform by xwiki.
the class EventGroupTest method testGetMainEvent.
@Test
public void testGetMainEvent() {
Event e1 = new DefaultEvent();
e1.setImportance(Importance.BACKGROUND);
Event e2 = new DefaultEvent();
e2.setImportance(Importance.MAJOR);
Event e3 = new DefaultEvent();
e3.setImportance(Importance.MAJOR);
Assert.assertNull(this.g.getMainEvent());
this.g.addEvents(e1);
Assert.assertEquals(e1, this.g.getMainEvent());
this.g.addEvents(e2);
Assert.assertEquals(e2, this.g.getMainEvent());
this.g.addEvents(e3);
Assert.assertEquals(e2, this.g.getMainEvent());
this.g.clearEvents();
Assert.assertNull(this.g.getMainEvent());
this.g.clearEvents();
this.g.addEvents(e3);
Assert.assertEquals(e3, this.g.getMainEvent());
this.g.addEvents(e2);
Assert.assertEquals(e3, this.g.getMainEvent());
this.g.addEvents(e1);
Assert.assertEquals(e3, this.g.getMainEvent());
this.g.clearEvents();
this.g.addEvents(e2);
Assert.assertEquals(e2, this.g.getMainEvent());
this.g.addEvents(e3);
Assert.assertEquals(e2, this.g.getMainEvent());
this.g.addEvents(e1);
Assert.assertEquals(e2, this.g.getMainEvent());
this.g.clearEvents();
this.g.addEvents(e3);
Assert.assertEquals(e3, this.g.getMainEvent());
this.g.addEvents(e3);
Assert.assertEquals(e3, this.g.getMainEvent());
this.g.addEvents(e2);
Assert.assertEquals(e3, this.g.getMainEvent());
}
Aggregations