|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.virtualmock.VM
The main interface to the VirtualMock runtime system. The unit test class makes method calls to this class to perform VirtualMock tasks.
| Field Summary | |
static AlwaysMatcher |
ALWAYS_MATCHER
Predefined AlwaysMatcher. |
static EqualsMatcher |
EQUALS_MATCHER
Predefined EqualsMatcher. |
| Constructor Summary | |
VM(CallManager callManager,
VerificationManager verificationManager)
Creates a new VM object. |
|
| Method Summary | |
void |
addMockClass(java.lang.Class classToMock)
This tells VirtualMock that subsequent calls to this class will be intercepted by VirtualMock. |
junit.framework.TestCase |
getTestCase()
Gets the TestCase class. |
void |
playbackCalls()
Sets VirtualMock into Playback Mode (defaulting to unordered playback type). |
void |
recordArgMatcher(ArgMatcher argMatcher)
Define an ArgMatcher for the last recorded call, which should only have a single argument. |
void |
recordArgMatchers(ArgMatcher[] argMatchers)
Define an ArgMatcher for the last recorded call, which should have the same number of arguments as there are elements in the array that is passed in. |
void |
recordArgMatchers(ArgMatcher firstArgMatcher,
ArgMatcher secondArgMatcher)
Define an ArgMatcher for the last recorded call, which should only have a two arguments. |
void |
recordArgMatchers(ArgMatcher firstArgMatcher,
ArgMatcher secondArgMatcher,
ArgMatcher thirdArgMatcher)
Define an ArgMatcher for the last recorded call, which should only have a three arguments. |
void |
recordException(java.lang.Throwable throwable)
Specifies that a throwable will be thrown by the last recorded call. |
void |
recordReturnValue(boolean booleanValue)
Specifies the boolean return value for the last recorded call. |
void |
recordReturnValue(byte byteValue)
Specifies the byte return value for the last recorded call. |
void |
recordReturnValue(char charValue)
Specifies the char return value for the last recorded call. |
void |
recordReturnValue(double doubleValue)
Specifies the double return value for the last recorded call. |
void |
recordReturnValue(float floatValue)
Specifies the float return value for the last recorded call. |
void |
recordReturnValue(int intValue)
Specifies the int return value for the last recorded call. |
void |
recordReturnValue(long longValue)
Specifies the long return value for the last recorded call. |
void |
recordReturnValue(java.lang.Object returnValue)
Specifies the return value for the last recorded call. |
void |
recordReturnValue(short shortValue)
Specifies the short return value for the last recorded call. |
void |
setTestCase(junit.framework.TestCase case1)
Sets the TestCase class. |
void |
verify()
Causes all verify-phase verifications to be performed. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final EqualsMatcher EQUALS_MATCHER
public static final AlwaysMatcher ALWAYS_MATCHER
| Constructor Detail |
public VM(CallManager callManager,
VerificationManager verificationManager)
callManager - the CallManager to be used by this VM runtime.verificationManager - the VerificationManager to be used by this VM
runtime.| Method Detail |
public void setTestCase(junit.framework.TestCase case1)
case1 - the TestCasepublic junit.framework.TestCase getTestCase()
public void addMockClass(java.lang.Class classToMock)
classToMock - The class for which VirtualMock will intercept calls.public void playbackCalls()
public void recordArgMatcher(ArgMatcher argMatcher)
Define an ArgMatcher for the last recorded call, which should only have a single argument.
This is an overloaded convenience method for setArgMatcher(ArgMatcher[]), which can be used to avoid creating an array if you only want to record a matcher for one argument.
argMatcher - The ArgMatcher that VirtualMock will use to verify
this argument when the last recorded call is invoked.
public void recordArgMatchers(ArgMatcher firstArgMatcher,
ArgMatcher secondArgMatcher)
Define an ArgMatcher for the last recorded call, which should only have a two arguments.
This is an overloaded convenience method for setArgMatcher(ArgMatcher[]), which can be used to avoid creating an array if you only want to record a matcher for two arguments.
firstArgMatcher - The ArgMatcher that VirtualMock will use to match
the first argument when the last recorded call is invoked.secondArgMatcher - The ArgMatcher that VirtualMock will use to
match the second argument when the last recorded call is
invoked.
public void recordArgMatchers(ArgMatcher firstArgMatcher,
ArgMatcher secondArgMatcher,
ArgMatcher thirdArgMatcher)
Define an ArgMatcher for the last recorded call, which should only have a three arguments.
This is an overloaded convenience method for setArgMatcher(ArgMatcher[]), which can be used to avoid creating an array if you only want to record a matcher for three arguments.
firstArgMatcher - The ArgMatcher that VirtualMock will use to match
the first argument when the last recorded call is invoked.secondArgMatcher - The ArgMatcher that VirtualMock will use to
match the second argument when the last recorded call is
invoked.thirdArgMatcher - The ArgMatcher that VirtualMock will use to match
the third argument when the last recorded call is invoked.public void recordArgMatchers(ArgMatcher[] argMatchers)
Define an ArgMatcher for the last recorded call, which should have the same number of arguments as there are elements in the array that is passed in.
argMatchers - The array of ArgMatchers that VirtualMock will use to
match the arguments when the last recorded call is invoked.public void recordException(java.lang.Throwable throwable)
throwable - the Throwable which the last recorded call will throw
when it is invoked.public void recordReturnValue(java.lang.Object returnValue)
returnValue - the value which the last recorded call will return
when it is invoked.public void recordReturnValue(int intValue)
intValue - the int value which the last recorded call will return
when it is invoked.public void recordReturnValue(float floatValue)
floatValue - the float value which the last recorded call will
return when it is invoked.public void recordReturnValue(double doubleValue)
doubleValue - the double value which the last recorded call will
return when it is invoked.public void recordReturnValue(byte byteValue)
byteValue - the byte value which the last recorded call will return
when it is invoked.public void recordReturnValue(long longValue)
longValue - the long value which the last recorded call will return
when it is invoked.public void recordReturnValue(short shortValue)
shortValue - the short value which the last recorded call will
return when it is invoked.public void recordReturnValue(boolean booleanValue)
booleanValue - the boolean value which the last recorded call will
return when it is invoked.public void recordReturnValue(char charValue)
charValue - the char value which the last recorded call will return
when it is invoked.public void verify()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||