Access keys

DefaultBehavior

Kind of class: class
Inherits from: BasicClass
Implements:
Author: Simon Wacker
Classpath: org.as2lib.test.mock.support.DefaultBehavior
File last modified: Friday, 01 July 2005, 19:57:42
DefaultBehavior stores expected behaviors and exposes them for
verification.

Constructor

DefaultBehavior

function DefaultBehavior (
Void)
Constructs a new DefaultBehavior instance.

Instance methods

addMethodBehavior

function addMethodBehavior (
methodName:String, methodBehavior:MethodBehavior) : Void
Adds the given methodBehavior behavior for the passed-in
methodName.

If the passed-in methodName is null or an empty string the one
returned by the method behaviour's expected method call will be used. If this
is also null or an empty string "[unknown]" will be used.

Parameters:
methodName :
the name of the method to register the methodBehavior
with
#
methodBehavior:
the method behavior to register
#
Throws:
org.as2lib.env.except.IllegalArgumentException if the passed-in methodBehavior is
null

createMethodBehavior

function createMethodBehavior (
expectedMethodCall:MethodCall) : MethodBehavior
Creates a new method behavior for the passed-in expectedMethodCall.
Parameters:
expectedMethodCall:
the method call to create a behavior for
Returns:
the created method behavior

getLastMethodBehavior

function getLastMethodBehavior (
Returns the lastly added method behavior.
Returns:
the lastly added method behavior

getMethodBehavior

function getMethodBehavior (
actualMethodCall:MethodCall) : MethodBehavior
Returns a method behavior that matches the given actualMethodCall.

null will be returned if:

  • The passed-in actualMethodCall is null.
  • There is no matching behavior registered.
Returns:
a matching method behavior

getMethodBehaviorFactory

function getMethodBehaviorFactory (
Returns either the factory set via setMethodBehaviorFactory or the
default one which returns an instance of class DefaultMethodBehavior.
Returns:
the currently used factory to obtain method call behaviors

removeAllBehaviors

function removeAllBehaviors (
Void) : Void
Removes all added behaviors.

setMethodBehaviorFactory

function setMethodBehaviorFactory (
methodBehaviorFactory:MethodBehaviorFactory) : Void
Sets the factory used to obtain method call behaviors to store state.

If methodBehaviorFactory is null the
getMethodBehaviorFactory method will return the default factory.

Parameters:
methodBehaviorFactory:
the new factory

verify

function verify (
Void) : Void
Verifies all added behaviors.