DefaultMethodBehavior
| Kind of class: | class |
|---|---|
| Inherits from: | BasicClass |
| Implements: | |
| Author: | Simon Wacker |
| Classpath: | org.as2lib.test.mock.support.DefaultMethodBehavior |
| File last modified: | Friday, 01 July 2005, 19:57:42 |
DefaultMethodBehavior stores the expected and actual behaviors of onemethod and verifies the expectation against the actual method calls.
Summary
Constructor
Instance methods
- getExpectedMethodCall
- addActualMethodCall
- addMethodResponse
- setArgumentsMatcher
- expectsAnotherMethodCall
- response
- verify
Instance methods inherited from BasicClass
Constructor
DefaultMethodBehavior
function DefaultMethodBehavior (
expectedMethodCall:MethodCall)
Constructs a new
DefaultMethodBehavior instance with the passed-inmethodCall.A expectedMethodCall of value null means that this behavior
expects no actual method calls.
Parameters:
expectedMethodCall:
the expected method call this behavior registers
expectations, actual calls and responses for
expectations, actual calls and responses for
Instance methods
addActualMethodCall
function addActualMethodCall (
actualMethodCall:MethodCall) : Void
Adds an actual method call.
The method call is added if it is not null and if it matches the
expected method call.
Parameters:
actualMethodCall:
the new actual method call to add
Throws:
org.as2lib.env.except.IllegalArgumentException if the passed-in
org.as2lib.test.mock.AssertionFailedError if no method call was expected or if the
total maximum call count has been exceeded
methodCall isnullorg.as2lib.test.mock.AssertionFailedError if no method call was expected or if the
actualMethodCall does not match the expected method call or if thetotal maximum call count has been exceeded
addMethodResponse
function addMethodResponse (
methodResponse:MethodResponse,
methodCallRange:MethodCallRange) : Void
Adds the new
that indicates when and how often the response shall take place.
methodResponse together with the methodCallRangethat indicates when and how often the response shall take place.
If you set no response, the behavior expects exactly one method call.
Parameters:
methodResponse :
the response to do a given number of times
methodCallRange:
the range that indicates how often the response can take
place
place
Throws:
org.as2lib.env.except.IllegalStateException if the expected method call is
nullexpectsAnotherMethodCall
function expectsAnotherMethodCall (
Void) : Boolean
Checks whether this behavior expects another method call.
Returns:
true if a further method call is expected else falsegetExpectedMethodCall
function getExpectedMethodCall (
Void) : MethodCall
Returns the expected method call.
Returns:
the expected method call
response
function response (
Void)
Responses depending on the current number of actual method calls.
Returns:
the response's return value@throw the response's throwable
Specified by:
setArgumentsMatcher
function setArgumentsMatcher (
argumentsMatcher:ArgumentsMatcher) : Void
Sets the passed-in
argumentsMatcher for the expected method call.Parameters:
argumentsMatcher:
the arguments matcher for the expected method call
verify
function verify (
Void) : Void
Verifies that the expactations have been met.
Throws:
org.as2lib.test.mock.AssertionFailedError if the verification fails
Specified by: