public interface EventFixture
given(Event event) method allow to test
which handler will received a given event. And the given(Class aClass) method allow to test which event is
fired by a given method.
EventHandler:
@Inject
private EventFixture fixture;
fixture.given(eventFactory.createMyEvent())
.whenFired()
.wasHandledBy(MyHandler.class);
EventHandlers:
@Inject
private EventFixture fixture;
fixture.given(eventFactory.createMyEvent())
.whenFired()
.wasHandledExactlyBy(MyHandler.class, MyHandler2.class);
EventHandler:
@Inject
private EventFixture fixture;
fixture.given(eventFactory.createMyEvent())
.whenFired()
.wasNotHandledBy(MyHandler3.class);
method() with appropriate *parameters*
@Inject
private EventFixture fixture;
MyEvent myEvent = eventFactory.createMyEvent(SOME_EVENT_PARAM);
fixtures.given(MyService.class)
.whenCalled("doSomething", SOME_METHOD_PARAM)
.eventWasHandledBy(myEvent, MyHandler.class);
Test if MyHandler handler received myEvent event when doSomething() method of MyService is called.| Modifier and Type | Method and Description |
|---|---|
ServiceProvider |
given(Class aClass)
Indicates the class to test.
|
EventProvider |
given(org.seedstack.business.api.Event event)
Indicates the event to test.
|
EventProvider given(org.seedstack.business.api.Event event)
event - event to testServiceProvider given(Class aClass)
aClass - class to testCopyright © 2013-2015–2015. All rights reserved.