Interface org.as2lib.test.mock.MockControlState

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

Description

MockControlState determines most of the actual behavior of the MockControl class.

The actual behavior of the specific methods of this class depends largely on the implementing class. Thus refer to these implementation classes.

Method Index

invokeMethod(), setArgumentsMatcher(), setMethodResponse(), verify()

Inherited from BasicInterface

toString()

Method Detail

invokeMethod

public function invokeMethod(call:MethodCall)

Is called when a method is called on the mock proxy.

Parameters

callcontains all information about the method call

Return

the return value of the method invocation in replay state

Throws

*if the method is set up to throw a throwable in replay state

setMethodResponse

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

Sets a new method response.

Record State
Records that the mock object will expect the last method call the specified number of times, and will react by either returning the return value, throwing an exception or just doing nothing.
Replay State
Throws an IllegalStateException.

Parameters

methodResponsehandles incoming requests appropriately
methodCallRangestores the minimum and maximum quantity of method calls

Throws

IllegalArgumentExceptionwhen in replay state

setArgumentsMatcher

public function setArgumentsMatcher(argumentsMatcher:ArgumentsMatcher):Void

Sets a new arguments matcher.

Record State
Sets the arguments matcher that will be used for the last method specified by a method call.
Replay State
Throws an IllegalStateException.

Parameters

argumentsMatcherthe arguments matcher to use for the specific method

Throws

IllegalArgumentExceptionwhen in replay state

verify

public function verify(Void):Void

Verifies the beahvior.

Replay State
Verifies that all expectations have been met.
Record State
Throws an IllegalStateException.

Throws

AssertionFailedErrorif any expectation has not been met in replay state
IllegalArgumentExceptionwhen in record state