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 Actionprivate booleanprivate static ParametersMatcherprivate Cardinalityprivate intprivate booleanprivate org.hamcrest.Matcher<? super Method> private org.hamcrest.Matcher<?> private List<OrderingConstraint> private ParametersMatcherprivate List<SideEffect> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOrderingConstraint(OrderingConstraint orderingConstraint) voidaddSideEffect(SideEffect sideEffect) booleanCan moreInvocations expected by this Expectation still occur?private voiddescribeExpectation(org.hamcrest.Description description) private voiddescribeMethod(org.hamcrest.Description description) voiddescribeMismatch(Invocation invocation, org.hamcrest.Description description) private voiddescribeSideEffects(org.hamcrest.Description description) voiddescribeTo(org.hamcrest.Description description) invoke(Invocation invocation) Invokes the expectation: records that the invocation has occurred and fakes some behaviour in response.private booleanbooleanHave enoughInvocations expected by this Expectation occurred?booleanmatches(Invocation invocation) Can the Expectation be invoked with invocation?private voidvoidvoidsetCardinality(Cardinality cardinality) voidsetDefaultAction(Action action) voidvoidsetMethodMatcher(org.hamcrest.Matcher<? super Method> matcher) voidsetObjectMatcher(org.hamcrest.Matcher<?> objectMatcher) voidsetParametersMatcher(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:
describeToin interfaceorg.hamcrest.SelfDescribing
-
describeMismatch
- Specified by:
describeMismatchin 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:ExpectationHave enoughInvocations expected by this Expectation occurred?- Specified by:
isSatisfiedin interfaceExpectation- Returns:
trueif the expectation has received enough of its expected invocations,falseotherwise.
-
allowsMoreInvocations
public boolean allowsMoreInvocations()Description copied from interface:ExpectationCan moreInvocations expected by this Expectation still occur?- Specified by:
allowsMoreInvocationsin interfaceExpectation- Returns:
trueif invocations expected by this expectation can still occur,falseotherwise.
-
matches
Description copied from interface:ExpectationCan the Expectation be invoked with invocation?- Specified by:
matchesin interfaceExpectation- Parameters:
invocation- to be matched- Returns:
trueif the expectation can be invoked with invocation,falseotherwise.
-
isInCorrectOrder
private boolean isInCorrectOrder() -
invoke
Description copied from interface:ExpectationInvokes the expectation: records that the invocation has occurred and fakes some behaviour in response.- Specified by:
invokein 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()
-