use of org.xwiki.eventstream.EventFactory in project xwiki-platform by xwiki.
the class MessageStreamTest method setupForNewMessage.
private Event setupForNewMessage() throws ComponentLookupException, Exception {
final EventFactory mockEventFactory = getComponentManager().getInstance(EventFactory.class);
final Event e = new DefaultEvent();
e.setId(UUID.randomUUID().toString());
final ModelContext mockContext = getComponentManager().getInstance(ModelContext.class);
final EventStream mockEventStream = getComponentManager().getInstance(EventStream.class);
getMockery().checking(new Expectations() {
{
exactly(1).of(mockEventFactory).createEvent();
will(returnValue(e));
exactly(1).of(mockContext).getCurrentEntityReference();
will(returnValue(new DocumentReference("wiki", "Space", "Page")));
exactly(1).of(mockEventStream).addEvent(e);
}
});
return e;
}
Aggregations