Class org.as2lib.test.mock.support.StateArgumentMatcher

org.as2lib.core.BasicClass
   +--org.as2lib.test.mock.support.StateArgumentMatcher

Implemented Interfaces

ArgumentMatcher

Description

StateArgumentMatcher checks whether one argument is in an expected state.

Method Index

new StateArgumentMatcher()

addExpectedProperty(), matchArgument()

Inherited from BasicClass

toString()

Constructor Detail

StateArgumentMatcher

public function StateArgumentMatcher(expectedType:Function)

Constructs a new StateArgumentMatcher instance.

If every type is allowed, specifc Object as expected type.

Parameters

expectedTypethe expected type of the argument

Throws

IllegalArgumentExceptionif type is null or undefined

Method Detail

addExpectedProperty

public function addExpectedProperty(propertyName:String, propertyValue):Void

Adds a new property the argument is expected to have.

Parameters

propertyNamethe name of the expected property
propertyValuethe value of the expected property

matchArgument

public function matchArgument(argument):Boolean

Checks whether the passed-in argument is in the expected state.

false will be returned if:

  • argument is null or undefined.
  • argument is not of the expected type.
  • argument is not in the expected state.

Parameters

argumentthe argument to check whether it is in the expected state

Return

true if the argument is in the expected state else false

Specified By

matchArgument() in org.as2lib.test.mock.ArgumentMatcher