public class TestSubscriber.AssertionChain
extends java.lang.Object
A fluent class used to walk the chain of events received by a TestSubscriber and make assertions against each event in the order received
AssertionChain does not make assertions against events as they come in, instead it asserts against the events received by the TestSubscriber when
TestSubscriber.beginAssertionChain() was called. This means in multi threaded situations you will likely have to use TestSubscriber.awaitEvent(Matcher)
to wait for the TestSubscriber to receive the events that you want to assert against.
| Modifier and Type | Method and Description |
|---|---|
TestSubscriber.AssertionChain |
assertNextEvent(org.hamcrest.Matcher<rx.Notification> eventMatcher)
Asserts that the next event matches the given matcher
|
TestSubscriber.AssertionChain |
assertNoRemainingEvents()
Asserts that all received events have been checked or skipped by this AssertionChain
|
TestSubscriber.AssertionChain |
ignoreNextEvent()
Skips the next event in the recorded event chain
|
TestSubscriber.AssertionChain |
ignoreNextEvents(int count)
Skips a given amount of events in the recorded event chain
|
TestSubscriber.AssertionChain |
ignoreUntilEvent(org.hamcrest.Matcher<rx.Notification> matcher)
Walks through the event chain skipping events until an event has been reached that matches the given matcher
|
TestSubscriber.AssertionChain |
ignoreUntilEvent(org.hamcrest.Matcher<rx.Notification> matcher,
int times)
Walks through the event chain skipping events until the given number of events have been reached that match the given matcher
|
public TestSubscriber.AssertionChain assertNextEvent(org.hamcrest.Matcher<rx.Notification> eventMatcher)
Asserts that the next event matches the given matcher
Fails: When the next event does not match, or when there is no next event
eventMatcher - The matcher to check withpublic TestSubscriber.AssertionChain ignoreNextEvent()
Skips the next event in the recorded event chain
This will not fail a test under any circumstances as this should eventually be followed by a assertNextEvent that would fail if there were no more events
public TestSubscriber.AssertionChain ignoreNextEvents(int count)
Skips a given amount of events in the recorded event chain
This will not fail a test under any circumstances as this should eventually be followed by a assertNextEvent that would fail if there were no more events
public TestSubscriber.AssertionChain ignoreUntilEvent(org.hamcrest.Matcher<rx.Notification> matcher, int times)
Walks through the event chain skipping events until the given number of events have been reached that match the given matcher
This does skip the last event matched, meaning that the next event will be the event immediately after the last matching event
Fails: When all events have been checked but not enough matching events were found
matcher - The matcher to check withtimes - How many matching events to skippublic TestSubscriber.AssertionChain ignoreUntilEvent(org.hamcrest.Matcher<rx.Notification> matcher)
Walks through the event chain skipping events until an event has been reached that matches the given matcher
This does skip the event matched, meaning that the next event will be the event immediately after the matching event
Fails: When all events have been checked but not enough matching events were found
matcher - The matcher to check withpublic TestSubscriber.AssertionChain assertNoRemainingEvents()