public class Expectations extends Object implements org.jmock.internal.ExpectationBuilder, CardinalityClause, ArgumentConstraintPhrases, ActionClause
| Modifier and Type | Field and Description |
|---|---|
protected WithClause |
with
Syntactic sugar for specifying arguments that are matchers for primitive types
or are untyped matchers.
|
| Constructor and Description |
|---|
Expectations() |
| Modifier and Type | Method and Description |
|---|---|
static Matcher<Object> |
a(Class<?> type)
Deprecated.
use
aNonNull(java.lang.Class<T>) or any(java.lang.Class<T>) until type inference actually works in a future version of Java |
MethodClause |
allowing(Matcher<?> mockObjectMatcher) |
<T> T |
allowing(T mockObject) |
static Matcher<Object> |
an(Class<?> type)
Deprecated.
use
aNonNull(java.lang.Class<T>) or any(java.lang.Class<T>) until type inference actually works in a future version of Java |
static <T> Matcher<T> |
aNonNull(Class<T> type) |
static <T> Matcher<T> |
aNull(Class<T> type) |
static <T> Matcher<T> |
any(Class<T> type) |
static <T> Matcher<T> |
anything() |
ReceiverClause |
atLeast(int count) |
ReceiverClause |
atMost(int count) |
ReceiverClause |
between(int minCount,
int maxCount) |
void |
buildExpectations(Action defaultAction,
org.jmock.internal.ExpectationCollector collector) |
protected org.jmock.internal.InvocationExpectationBuilder |
currentBuilder() |
static Action |
doAll(Action... actions) |
static <T> Matcher<T> |
equal(T value) |
ReceiverClause |
exactly(int count) |
MethodClause |
ignoring(Matcher<?> mockObjectMatcher) |
<T> T |
ignoring(T mockObject) |
void |
inSequence(Sequence sequence) |
void |
inSequences(Sequence... sequences) |
<T> T |
never(T mockObject) |
static Action |
onConsecutiveCalls(Action... actions) |
<T> T |
one(T mockObject)
Deprecated.
Use
oneOf instead. |
<T> T |
oneOf(T mockObject) |
static Action |
returnEnumeration(Collection<?> collection) |
static <T> Action |
returnEnumeration(T... items) |
static Action |
returnIterator(Collection<?> collection) |
static <T> Action |
returnIterator(T... items) |
static Action |
returnValue(Object result) |
static <T> Matcher<T> |
same(T value) |
void |
then(org.jmock.internal.State state) |
static Action |
throwException(Throwable throwable) |
void |
when(org.jmock.internal.StatePredicate predicate) |
void |
will(Action action) |
boolean |
with(boolean value) |
byte |
with(byte value) |
char |
with(char value) |
double |
with(double value) |
float |
with(float value) |
int |
with(int value) |
long |
with(long value) |
<T> T |
with(Matcher<T> matcher)
For Matchers with primitive types use the with field, for example:
|
short |
with(short value) |
<T> T |
with(T value) |
protected final WithClause with
public void buildExpectations(Action defaultAction, org.jmock.internal.ExpectationCollector collector)
buildExpectations in interface org.jmock.internal.ExpectationBuilderprotected org.jmock.internal.InvocationExpectationBuilder currentBuilder()
public ReceiverClause exactly(int count)
exactly in interface CardinalityClausepublic <T> T oneOf(T mockObject)
oneOf in interface CardinalityClausepublic <T> T one(T mockObject)
oneOf instead.one in interface CardinalityClausepublic ReceiverClause atLeast(int count)
atLeast in interface CardinalityClausepublic ReceiverClause between(int minCount, int maxCount)
between in interface CardinalityClausepublic ReceiverClause atMost(int count)
atMost in interface CardinalityClausepublic MethodClause allowing(Matcher<?> mockObjectMatcher)
allowing in interface CardinalityClausepublic <T> T allowing(T mockObject)
allowing in interface CardinalityClausepublic <T> T ignoring(T mockObject)
ignoring in interface CardinalityClausepublic MethodClause ignoring(Matcher<?> mockObjectMatcher)
ignoring in interface CardinalityClausepublic <T> T never(T mockObject)
never in interface CardinalityClausepublic <T> T with(Matcher<T> matcher)
with.intIs(equalTo(34));For untyped matchers use:
with.<T>is(equalTo(anObject));
with in interface ArgumentConstraintPhrasespublic boolean with(boolean value)
public byte with(byte value)
public short with(short value)
public char with(char value)
public int with(int value)
public long with(long value)
public float with(float value)
public double with(double value)
public <T> T with(T value)
public void will(Action action)
will in interface ActionClausepublic static <T> Matcher<T> equal(T value)
public static <T> Matcher<T> same(T value)
public static <T> Matcher<T> anything()
@Deprecated public static Matcher<Object> a(Class<?> type)
aNonNull(java.lang.Class<T>) or any(java.lang.Class<T>) until type inference actually works in a future version of Java@Deprecated public static Matcher<Object> an(Class<?> type)
aNonNull(java.lang.Class<T>) or any(java.lang.Class<T>) until type inference actually works in a future version of Javapublic static Action returnIterator(Collection<?> collection)
public static <T> Action returnIterator(T... items)
public static Action returnEnumeration(Collection<?> collection)
public static <T> Action returnEnumeration(T... items)
public void when(org.jmock.internal.StatePredicate predicate)
public void then(org.jmock.internal.State state)
public void inSequence(Sequence sequence)
public void inSequences(Sequence... sequences)