public class InvocationExpectation extends Object implements Expectation
Constructor and Description |
---|
InvocationExpectation() |
Modifier and Type | Method and Description |
---|---|
void |
addOrderingConstraint(OrderingConstraint orderingConstraint) |
void |
addSideEffect(SideEffect sideEffect) |
boolean |
allowsMoreInvocations()
Can more
Invocation s expected by this Expectation still occur? |
void |
describeMismatch(Invocation invocation,
org.hamcrest.Description description) |
void |
describeTo(org.hamcrest.Description description) |
Object |
invoke(Invocation invocation)
Invokes the expectation: records that the invocation has
occurred and fakes some behaviour in response.
|
boolean |
isSatisfied()
Have enough
Invocation s expected by this Expectation occurred? |
boolean |
matches(Invocation invocation)
Can the Expectation be invoked with invocation?
|
void |
setAction(Action action) |
void |
setCardinality(Cardinality cardinality) |
void |
setDefaultAction(Action action) |
void |
setMethod(Method method) |
void |
setMethodMatcher(org.hamcrest.Matcher<? super Method> matcher) |
void |
setObjectMatcher(org.hamcrest.Matcher<?> objectMatcher) |
void |
setParametersMatcher(ParametersMatcher parametersMatcher) |
public void setCardinality(Cardinality cardinality)
public void setObjectMatcher(org.hamcrest.Matcher<?> objectMatcher)
public void setMethod(Method method)
public void setMethodMatcher(org.hamcrest.Matcher<? super Method> matcher)
public void setParametersMatcher(ParametersMatcher parametersMatcher)
public void addOrderingConstraint(OrderingConstraint orderingConstraint)
public void addSideEffect(SideEffect sideEffect)
public void setAction(Action action)
public void setDefaultAction(Action action)
public void describeTo(org.hamcrest.Description description)
describeTo
in interface org.hamcrest.SelfDescribing
public void describeMismatch(Invocation invocation, org.hamcrest.Description description)
describeMismatch
in interface Expectation
public boolean isSatisfied()
Expectation
Invocation
s expected by this Expectation occurred?isSatisfied
in interface Expectation
true
if the expectation has received enough
of its expected invocations, false
otherwise.public boolean allowsMoreInvocations()
Expectation
Invocation
s expected by this Expectation still occur?allowsMoreInvocations
in interface Expectation
true
if invocations expected by this expectation can still
occur, false
otherwise.public boolean matches(Invocation invocation)
Expectation
matches
in interface Expectation
invocation
- to be matchedtrue
if the expectation can be invoked with
invocation, false
otherwise.public Object invoke(Invocation invocation) throws Throwable
Expectation
invoke
in interface Expectation
invocation
- The invocation to record and fake.Throwable
- An exception that is eventually thrown from the method call
that caused the invocation.IllegalStateException
- The expectation has been invoked with a method that it doesn't
match or the faked behaviour has been set up incorrectly.
For example, IllegalStateException is thrown when trying to return
a value or throw a checked exception that is incompatible with the
return type of the method being mockedCopyright © 2003–2021 jMock. All rights reserved.