public class Expecter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Expecter.AbstractPredicate
Subclass this and override isExpected(Tuple t) to simplify creating predicates.
|
static class |
Expecter.DequeueSetting |
static interface |
Expecter.Predicate
To expect tuples by predicate, implement this interface.
|
Constructor and Description |
---|
Expecter(Dequeuer stream) |
Expecter(Dequeuer stream,
TupleComparator comparator) |
Modifier and Type | Method and Description |
---|---|
void |
expect(Expecter.DequeueSetting mode,
java.util.List<Tuple> expected)
Expect multiple tuples in a particular order from the dequeuer
|
void |
expect(Expecter.DequeueSetting mode,
Tuple... tuples)
Expect multiple tuples in a particular order from the dequeuer
|
void |
expect(Expecter.DequeueSetting mode,
Tuple expected)
Expect a given tuple from the dequeuer
|
<T> void |
expect(Expecter.DequeueSetting mode,
TupleMaker<T> tupleMaker,
java.util.List<T> t)
Expect a tuple from the dequeuer
|
<T> void |
expect(Expecter.DequeueSetting mode,
TupleMaker<T> tupleMaker,
T... t)
Expect a tuple from the dequeuer
|
<T> void |
expect(Expecter.DequeueSetting mode,
TupleMaker<T> tupleMaker,
T t)
Expect a tuple from the dequeuer
|
void |
expect(java.util.List<Tuple> expected)
Expect multiple tuples in a particular order from the dequeuer.
|
void |
expect(Tuple... tuples)
Expect multiple tuples in a particular order from the dequeuer.
|
void |
expect(Tuple tuple)
Expect a tuple from the dequeuer.
|
<T> void |
expect(TupleMaker<T> tupleMaker,
java.util.List<T> t)
Expect multiple tuples in a particular order from the dequeuer.
|
<T> void |
expect(TupleMaker<T> tupleMaker,
T... t)
Expect multiple tuples in a particular order from the dequeuer.
|
<T> void |
expect(TupleMaker<T> tupleMaker,
T t)
Expect a tuple from the dequeuer.
|
void |
expectNothing()
Expect no tuples to be available on the stream, while ensuring that the server
has time to process any tuples that are currently in flight.
|
void |
expectNothing(long time,
java.util.concurrent.TimeUnit unit)
Expect no tuples to be available on the stream, while ensuring that the server
has time to process any tuples that are currently in flight.
|
void |
expectPredicate(Expecter.DequeueSetting mode,
Expecter.Predicate p)
Expect a tuple that fulfills the given predicate from the dequeuer
|
void |
expectPredicate(Expecter.DequeueSetting mode,
java.util.List<Expecter.Predicate> expected)
Expect a number of tuples, each fulfilling one predicate in a list, from the Dequeuer
|
void |
expectUnordered(Expecter.DequeueSetting mode,
java.util.List<Tuple> expected)
Expect multiple tuples in any order from the dequeuer
|
void |
expectUnordered(Expecter.DequeueSetting mode,
Tuple... expected)
Expect multiple tuples in any order from the dequeuer
|
<T> void |
expectUnordered(Expecter.DequeueSetting mode,
TupleMaker<T> tupleMaker,
java.util.List<T> t)
Expect multiple tuples in any order from the dequeuer
|
<T> void |
expectUnordered(Expecter.DequeueSetting mode,
TupleMaker<T> tupleMaker,
T... t)
Expect multiple tuples in any order from the dequeuer
|
void |
expectUnordered(java.util.List<Tuple> expected)
Expect multiple tuples in any order from the dequeuer.
|
void |
expectUnordered(Tuple... expected)
Expect multiple tuples in any order from the dequeuer.
|
<T> void |
expectUnordered(TupleMaker<T> tupleMaker,
java.util.List<T> t)
Expect multiple tuples in any order from the dequeuer.
|
<T> void |
expectUnordered(TupleMaker<T> tupleMaker,
T... t)
Expect multiple tuples in any order from the dequeuer.
|
void |
expectUnorderedPredicate(Expecter.DequeueSetting mode,
java.util.List<Expecter.Predicate> expected)
Expect tuples that fulfill multiple predicates in any order from the dequeuer
|
long |
getTimeout(java.util.concurrent.TimeUnit unit)
get the timeout that the expector will use for each call to expect*()
|
void |
setTimeout(long time,
java.util.concurrent.TimeUnit unit)
Set the timeout that the expector should assume for each call to expect*()
|
public Expecter(Dequeuer stream)
public Expecter(Dequeuer stream, TupleComparator comparator)
public void setTimeout(long time, java.util.concurrent.TimeUnit unit)
public long getTimeout(java.util.concurrent.TimeUnit unit)
unit
- the unit in which to return the result.public void expect(Expecter.DequeueSetting mode, Tuple expected) throws StreamBaseException
mode
- whether to allow extra tuples or require the next tuple to match exactlyexpected
- the tuple to expectStreamBaseException
- if expected match does not arrivepublic void expectPredicate(Expecter.DequeueSetting mode, Expecter.Predicate p) throws StreamBaseException
mode
- whether to allow extra tuples or require the next tuple to match the predicatep
- the predicateStreamBaseException
- if expected match does not arrivepublic void expect(Tuple tuple) throws StreamBaseException
expect(DequeueSetting.DISALLOW_EXTRA_TUPLES, tuple);
StreamBaseException
- if the next dequeued tuple does not match the expected tuple.public void expect(Expecter.DequeueSetting mode, java.util.List<Tuple> expected) throws StreamBaseException
mode
- whether to allow extra tuples or require the tuples to match without intermediate tuplesexpected
- the tuples to expectStreamBaseException
- if the next dequeued tuple does not match the expected tuple.public void expectPredicate(Expecter.DequeueSetting mode, java.util.List<Expecter.Predicate> expected) throws StreamBaseException
mode
- whether to allow extra tuples or require the tuples to match without intermediate tuplesexpected
- the predicates we expect the dequeued tuples to fulfillStreamBaseException
- if the expected tuples do not arrivepublic void expect(java.util.List<Tuple> expected) throws StreamBaseException
expect(DequeueSetting.DISALLOW_EXTRA_TUPLES, expected);
StreamBaseException
- if the dequeued tuples do not match the expected tuples.public void expect(Expecter.DequeueSetting mode, Tuple... tuples) throws StreamBaseException
mode
- whether to allow extra tuples or require the tuples to match without intermediate tuplesStreamBaseException
- if the dequeued tuples do not match the expected tuples.public void expect(Tuple... tuples) throws StreamBaseException
expect(DequeueSetting.DISALLOW_EXTRA_TUPLES, tuples);
StreamBaseException
- if the dequeued tuples do not match the expected tuples.public <T> void expect(Expecter.DequeueSetting mode, TupleMaker<T> tupleMaker, T t) throws StreamBaseException
mode
- whether to allow extra tuples or require the tuples to match without intermediate tuplesStreamBaseException
- if the next dequeued tuple does not match the expected tuple.public <T> void expect(TupleMaker<T> tupleMaker, T t) throws StreamBaseException
expect(DequeueSetting.DISALLOW_EXTRA_TUPLES, tupleMaker, t);
StreamBaseException
- if the next dequeued tuple does not match the expected tuple.public <T> void expect(Expecter.DequeueSetting mode, TupleMaker<T> tupleMaker, T... t) throws StreamBaseException
mode
- whether to allow extra tuples or require the tuples to match without intermediate tuplesStreamBaseException
- if the next dequeued tuple does not match the expected tuple.public <T> void expect(TupleMaker<T> tupleMaker, T... t) throws StreamBaseException
expect(DequeueSetting.DISALLOW_EXTRA_TUPLES, tupleMaker, t);
StreamBaseException
- if the dequeued tuples do not match the expected tuples.public <T> void expect(Expecter.DequeueSetting mode, TupleMaker<T> tupleMaker, java.util.List<T> t) throws StreamBaseException
mode
- whether to allow extra tuples or require the tuples to match without intermediate tuplesStreamBaseException
- if the next dequeued tuple does not match the expected tuple.public <T> void expect(TupleMaker<T> tupleMaker, java.util.List<T> t) throws StreamBaseException
expect(DequeueSetting.DISALLOW_EXTRA_TUPLES, tupleMaker, t);
StreamBaseException
- if the dequeued tuples do not match the expected tuples.public void expectUnordered(Expecter.DequeueSetting mode, java.util.List<Tuple> expected) throws StreamBaseException
mode
- whether to allow extra tuples or require the tuples to match without intermediate tuplesexpected
- the expected tuplesStreamBaseException
- if the dequeued tuples do not match the expected tuples.public void expectUnorderedPredicate(Expecter.DequeueSetting mode, java.util.List<Expecter.Predicate> expected) throws StreamBaseException
mode
- whether to allow extra tuples or require the tuples to match without intermediate tuplesexpected
- the predicates incoming tuples are expected to matchStreamBaseException
- if the dequeued tuples do not match the expected predicates.public void expectUnordered(java.util.List<Tuple> expected) throws StreamBaseException
expectUnordered(DequeueSetting.DISALLOW_EXTRA_TUPLES, expected);
StreamBaseException
- if the dequeued tuples do not match the expected tuples.public void expectUnordered(Expecter.DequeueSetting mode, Tuple... expected) throws StreamBaseException
mode
- whether to allow extra tuples or require the tuples to match without intermediate tuplesexpected
- the expected tuplesStreamBaseException
- if the dequeued tuples do not match the expected tuples.public void expectUnordered(Tuple... expected) throws StreamBaseException
expectUnordered(DequeueSetting.DISALLOW_EXTRA_TUPLES, expected);
StreamBaseException
- if the dequeued tuples do not match the expected tuples.public <T> void expectUnordered(Expecter.DequeueSetting mode, TupleMaker<T> tupleMaker, T... t) throws StreamBaseException
StreamBaseException
- if the dequeued tuples do not match the expected tuples.public <T> void expectUnordered(TupleMaker<T> tupleMaker, T... t) throws StreamBaseException
expectUnordered(DequeueSetting.DISALLOW_EXTRA_TUPLES, tupleMaker, t);
StreamBaseException
- if the dequeued tuples do not match the expected tuples.public <T> void expectUnordered(Expecter.DequeueSetting mode, TupleMaker<T> tupleMaker, java.util.List<T> t) throws StreamBaseException
StreamBaseException
- if the dequeued tuples do not match the expected tuples.public <T> void expectUnordered(TupleMaker<T> tupleMaker, java.util.List<T> t) throws StreamBaseException
expectUnordered(DequeueSetting.DISALLOW_EXTRA_TUPLES, tupleMaker, t);
StreamBaseException
- if the dequeued tuples do not match the expected tuples.public void expectNothing(long time, java.util.concurrent.TimeUnit unit) throws StreamBaseException
time
- the period of time to dequeue for (must be ≥ 0)unit
- the unit for timeStreamBaseException
public void expectNothing() throws StreamBaseException
StreamBaseException