|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.hammingweight.hammock.ATestDoubleHandler
public abstract class ATestDoubleHandler
The ATestDoubleHandler
class is an
IInvocationHandler
that can be extended to support mock and spy
objects. The class allows expectations to be set that certain methods will be
invoked on mock objects.
The class is an example of the composite pattern; it is an aggregation of
MethodHandler
instances. A MethodHandler
can
respond to only one method; the ATestDouble
can respond to more
than one method. The methods that this handler must respond to are set via
the setExpectation
and setStubExpectation
methods.
Field Summary |
---|
Fields inherited from interface com.hammingweight.hammock.IClassDefinitions |
---|
BOOLEAN_CLASS, BYTE_CLASS, CHARACTER_CLASS, DOUBLE_CLASS, FLOAT_CLASS, IMOCKOBJECT_CLASS, INTEGER_CLASS, LONG_CLASS, OBJECT_CLASS, SHORT_CLASS, THROWABLE_CLASS |
Constructor Summary | |
---|---|
ATestDoubleHandler()
|
Method Summary | |
---|---|
protected MethodHandler |
getExpectation(int expectationNumber)
A method to get the MethodHandler for a particular expectation. |
protected int |
getNumberOfExpectations()
A method to determine how many expectations have been set. |
MethodHandler |
setExpectation(MockMethod method)
This method sets an expectation that method will be called on a mock object. |
MethodHandler |
setExpectation(MockMethod method,
IMockObject mockObject)
This method sets an expectation that a particular method will be invoked on a particular object. |
MethodHandler |
setExpectation(MockMethod method,
IMockObject mockObject,
java.lang.Object[] args)
This method sets an expectation that a particular method will be invoked on a particular object with a particular set of arguments. |
MethodHandler |
setExpectation(MockMethod method,
java.lang.Object[] args)
This method sets an expectation that a particular method will be invoked with a particular set of arguments. |
MethodHandler |
setStubExpectation(MockMethod method)
This method allows the handler to respond identically to an arbitrary, possibly zero, number of invocations of a particular method. |
MethodHandler |
setStubExpectation(MockMethod method,
IMockObject mockObject)
This method allows the handler to respond identically to an arbitrary, possibly zero, number of invocations of a particular method on a mock object. |
MethodHandler |
setStubExpectation(MockMethod method,
IMockObject mockObject,
java.lang.Object[] args)
This method allows the handler to respond identically to an arbitrary, possibly zero, number of invocations of a particular method on a mock object with a particular set of arguments |
MethodHandler |
setStubExpectation(MockMethod method,
java.lang.Object[] args)
This method allows the handler to respond identically to an arbitrary, possibly zero, number of invocations of a particular method with a particular set of arguments. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.hammingweight.hammock.IInvocationHandler |
---|
invoke |
Constructor Detail |
---|
public ATestDoubleHandler()
Method Detail |
---|
public MethodHandler setExpectation(MockMethod method)
method
- The method that we expect to be invoked.
public MethodHandler setExpectation(MockMethod method, java.lang.Object[] args)
method
- The method that we expect to be invoked.args
- The arguments that are expected to be passed in the method
invocation.
public MethodHandler setExpectation(MockMethod method, IMockObject mockObject)
method
- The method that we expect to be invoked.mockObject
- The object that we expect the method to be invoked on.
public MethodHandler setExpectation(MockMethod method, IMockObject mockObject, java.lang.Object[] args)
method
- The method that we expect to be invoked.mockObject
- The object that we expect the method to be invoked on.args
- The arguments that are expected to be passed in the method
invocation.
public MethodHandler setStubExpectation(MockMethod method)
method
- The method that may be invoked.
public MethodHandler setStubExpectation(MockMethod method, java.lang.Object[] args)
method
- The method that may be invoked.args
- The arguments that are expected to be passed in the method
invocation.
public MethodHandler setStubExpectation(MockMethod method, IMockObject mockObject)
method
- The method that may be invoked.mockObject
- The object that we expect the method to be invoked on.
public MethodHandler setStubExpectation(MockMethod method, IMockObject mockObject, java.lang.Object[] args)
method
- The method that may be invoked.mockObject
- The object that we expect the method to be invoked on.args
- The arguments that are expected to be passed in the method
invocation.
protected int getNumberOfExpectations()
protected MethodHandler getExpectation(int expectationNumber)
expectationNumber
- The expectation of interest.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |