org.axonframework.test.saga
Class EventValidator

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

public class EventValidator
extends Object
implements org.axonframework.eventhandling.EventListener

Helper class for validating events published on a given EventBus.

Since:
1.1
Author:
Allard Buijze

Constructor Summary
EventValidator(org.axonframework.eventhandling.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(org.axonframework.domain.EventMessage 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(org.axonframework.eventhandling.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(org.axonframework.domain.EventMessage event)
Specified by:
handle in interface org.axonframework.eventhandling.EventListener

startRecording

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



Copyright © 2010-2016. All Rights Reserved.