|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.hammingweight.hammock.InvocationVerifier
public class InvocationVerifier
The InvocationVerifier
class is a helper class for
verifying that methods were invoked as expected; in particular it is used
with spy objects.
Field Summary |
---|
Constructor Summary | |
---|---|
InvocationVerifier(InvocationMatcher matcher,
MethodInvocation[] methodInvocations)
Constructor. |
Method Summary | |
---|---|
int |
getInvocationCount()
|
InvocationVerifier |
ignoreArgument(int argIndex)
Ignores a particular argument when checking whether a method was invoked with the expected arguments. |
boolean |
isVerified()
A method to check whether an expected method was invoked an expected number of times. |
InvocationVerifier |
setArgumentMatcher(int argIndex,
IArgumentMatcher argMatcher)
Sets the IArgumentMatcher to use for matching method
invocations. |
InvocationVerifier |
setInvocationCount(int numInvocations)
A method to set the number of times that the expected method should have been called. |
InvocationVerifier |
setInvocationCount(int minNumInvocations,
int maxNumInvocations)
A method to set the number of times that the expected method should have been called. |
void |
verify()
A method to check whether an expected method was invoked an expected number of times. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InvocationVerifier(InvocationMatcher matcher, MethodInvocation[] methodInvocations)
matcher
- The MethodInvocationMatcher
to match actual
invocations against expected invocations.methodInvocations
- The methods invoked on a test double.Method Detail |
---|
public boolean isVerified()
setInvocationCount
has been called,
this method will verify that the expected method has been invoked at
least once.
true
if an expected method was invoked, an expected
number of times.public void verify()
setInvocationCount
has been called,
this method will verify that the expected method has been invoked at
least once.
HammockException
- if the method wasn't invoked as expected.public InvocationVerifier setInvocationCount(int numInvocations)
numInvocations
- The exact number of times that the method should have been
invoked.
this
.public InvocationVerifier setInvocationCount(int minNumInvocations, int maxNumInvocations)
minNumInvocations
- The minimum allowed number of invocations.maxNumInvocations
- The maximum allowed number of invocations.
this
.public InvocationVerifier setArgumentMatcher(int argIndex, IArgumentMatcher argMatcher)
IArgumentMatcher
to use for matching method
invocations.
argIndex
- The index of the method argument.argMatcher
- The matcher to use.
this
.public InvocationVerifier ignoreArgument(int argIndex)
argIndex
- The argument index to ignore.
this
.public int getInvocationCount()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |