Interface org.as2lib.test.mock.MethodBehavior

org.as2lib.core.BasicInterface
   +--org.as2lib.test.mock.MethodBehavior

Description

MethodBehavior stores the expected and actual behaviors of one method and verifies the expectation against the actual method calls.

Method Index

addActualMethodCall(), addMethodResponse(), expectsAnotherMethodCall(), getExpectedMethodCall(), response(), setArgumentsMatcher(), verify()

Inherited from BasicInterface

toString()

Method Detail

getExpectedMethodCall

public function getExpectedMethodCall(Void):MethodCall

Returns the expected method call.

Return

the expected method call

addActualMethodCall

public function addActualMethodCall(actualMethodCall:MethodCall):Void

Adds a new actual method call.

Parameters

actualMethodCallthe new actual method call

Throws

AssertionFailedErrorif the maximum number of expected actual method calls has been passed

addMethodResponse

public function addMethodResponse(methodResponse:MethodResponse, methodCallRange:MethodCallRange):Void

Adds the new methodResponse together with the methodCallRange that indicates when and how often the response shall take place.

If you set no response, the behavior expects exactly one method call.

Parameters

methodResponsethe response to do a given number of times
methodCallRangethe range that indicates how often the response can take place

setArgumentsMatcher

public function setArgumentsMatcher(argumentsMatcher:ArgumentsMatcher):Void

Sets the passed-in argumentsMatcher for the expected method call.

Parameters

argumentsMatcherthe arguments matcher for the expected method call

expectsAnotherMethodCall

public function expectsAnotherMethodCall(Void):Boolean

Checks whether this behavior expects another method call.

Return

true if a further method call is expected else false

response

public function response(Void)

Responses depending on the current number of actual method calls.

Return

the response's return value

verify

public function verify(Void):Void

Verifies that the expactations have been met.

Throws

AssertionFailedErrorif the verification fails