org.axonframework.test.saga
Class EventValidator

java.lang.Object
  extended by org.axonframework.test.saga.EventValidator
All Implemented Interfaces:
EventListener

public class EventValidator
extends Object
implements EventListener

Helper class for validating events published on a given EventBus.

Since:
1.1
Author:
Allard Buijze

Constructor Summary
EventValidator(EventBus eventBus, FieldFilter fieldFilter)
          Initializes the event validator to monitor the given eventBus.
 
Method Summary
 void assertPublishedEvents(Object... expected)
          Assert that the given expected events have been published.
 void assertPublishedEventsMatching(org.hamcrest.Matcher<? extends Iterable<?>> matcher)
          Asserts that events have been published matching the given matcher.
 void handle(EventMessage event)
          Process the given event.
 void startRecording()
          Starts recording event published by the event bus.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventValidator

public EventValidator(EventBus eventBus,
                      FieldFilter fieldFilter)
Initializes the event validator to monitor the given eventBus.

Parameters:
eventBus - the event bus to monitor
fieldFilter - the filter describing the Fields to include in a comparison
Method Detail

assertPublishedEventsMatching

public void assertPublishedEventsMatching(org.hamcrest.Matcher<? extends Iterable<?>> matcher)
Asserts that events have been published matching the given matcher.

Parameters:
matcher - The matcher that will validate the actual events

assertPublishedEvents

public void assertPublishedEvents(Object... expected)
Assert that the given expected events have been published.

Parameters:
expected - the events that must have been published.

handle

public void handle(EventMessage event)
Description copied from interface: EventListener
Process the given event. The implementation may decide to process or skip the given event. It is highly unrecommended to throw any exception during the event handling process.

Specified by:
handle in interface EventListener
Parameters:
event - the event to handle

startRecording

public void startRecording()
Starts recording event published by the event bus.



Copyright © 2010-2016. All Rights Reserved.