Package org.jmock.internal
Class InvocationExpectation
java.lang.Object
org.jmock.internal.InvocationExpectation
- All Implemented Interfaces:
org.hamcrest.SelfDescribing
,Expectation
An expectation of zero or more matching invocations.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Action
private boolean
private static ParametersMatcher
private Cardinality
private int
private boolean
private org.hamcrest.Matcher
<? super Method> private org.hamcrest.Matcher
<?> private List
<OrderingConstraint> private ParametersMatcher
private List
<SideEffect> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addOrderingConstraint
(OrderingConstraint orderingConstraint) void
addSideEffect
(SideEffect sideEffect) boolean
Can moreInvocation
s expected by this Expectation still occur?private void
describeExpectation
(org.hamcrest.Description description) private void
describeMethod
(org.hamcrest.Description description) void
describeMismatch
(Invocation invocation, org.hamcrest.Description description) private void
describeSideEffects
(org.hamcrest.Description description) void
describeTo
(org.hamcrest.Description description) invoke
(Invocation invocation) Invokes the expectation: records that the invocation has occurred and fakes some behaviour in response.private boolean
boolean
Have enoughInvocation
s expected by this Expectation occurred?boolean
matches
(Invocation invocation) Can the Expectation be invoked with invocation?private void
void
void
setCardinality
(Cardinality cardinality) void
setDefaultAction
(Action action) void
void
setMethodMatcher
(org.hamcrest.Matcher<? super Method> matcher) void
setObjectMatcher
(org.hamcrest.Matcher<?> objectMatcher) void
setParametersMatcher
(ParametersMatcher parametersMatcher) private boolean
-
Field Details
-
ANY_PARAMETERS
-
cardinality
-
objectMatcher
private org.hamcrest.Matcher<?> objectMatcher -
methodMatcher
-
methodIsKnownToBeVoid
private boolean methodIsKnownToBeVoid -
parametersMatcher
-
action
-
actionIsDefault
private boolean actionIsDefault -
orderingConstraints
-
sideEffects
-
invocationCount
private int invocationCount
-
-
Constructor Details
-
InvocationExpectation
public InvocationExpectation()
-
-
Method Details
-
setCardinality
-
setObjectMatcher
public void setObjectMatcher(org.hamcrest.Matcher<?> objectMatcher) -
setMethod
-
setMethodMatcher
-
setParametersMatcher
-
addOrderingConstraint
-
addSideEffect
-
setAction
-
setDefaultAction
-
describeTo
public void describeTo(org.hamcrest.Description description) - Specified by:
describeTo
in interfaceorg.hamcrest.SelfDescribing
-
describeMismatch
- Specified by:
describeMismatch
in interfaceExpectation
-
describeExpectation
private void describeExpectation(org.hamcrest.Description description) -
describeMethod
private void describeMethod(org.hamcrest.Description description) -
describeSideEffects
private void describeSideEffects(org.hamcrest.Description description) -
shouldSuppressActionDescription
private boolean shouldSuppressActionDescription() -
isSatisfied
public boolean isSatisfied()Description copied from interface:Expectation
Have enoughInvocation
s expected by this Expectation occurred?- Specified by:
isSatisfied
in interfaceExpectation
- Returns:
true
if the expectation has received enough of its expected invocations,false
otherwise.
-
allowsMoreInvocations
public boolean allowsMoreInvocations()Description copied from interface:Expectation
Can moreInvocation
s expected by this Expectation still occur?- Specified by:
allowsMoreInvocations
in interfaceExpectation
- Returns:
true
if invocations expected by this expectation can still occur,false
otherwise.
-
matches
Description copied from interface:Expectation
Can the Expectation be invoked with invocation?- Specified by:
matches
in interfaceExpectation
- Parameters:
invocation
- to be matched- Returns:
true
if the expectation can be invoked with invocation,false
otherwise.
-
isInCorrectOrder
private boolean isInCorrectOrder() -
invoke
Description copied from interface:Expectation
Invokes the expectation: records that the invocation has occurred and fakes some behaviour in response.- Specified by:
invoke
in interfaceExpectation
- Parameters:
invocation
- The invocation to record and fake.- Returns:
- A result that is eventually returned from the method call that caused the invocation.
- Throws:
Throwable
- An exception that is eventually thrown from the method call that caused the invocation.
-
performSideEffects
private void performSideEffects()
-