org.mockcentral.server
Class MethodExpectationBean

java.lang.Object
  extended by org.mockcentral.server.MethodExpectationBean

public class MethodExpectationBean
extends java.lang.Object

A simple bean class used for creating a method expectation for a Mock Object. This class stores SignaturePartBean objects used to create the method parameters and expected result for the method, as well as the method name and Mock Object method type ("match and return", "expect and throw", etc), which will be represented by a MockMethodType enum value. if the anyParams flag is set, the ParamsBuilder class will construct an AnyConstraintMatcher for the expectation, meaning that the Mock Object will accept invocations of the method with any (or no) parameters.

The "add" and "set" methods defined in this class are invoked by the org.apache.commons.digester.Digester when the configuration file is parsed, and should not be called by clients.

Author:
David Hutchinson
See Also:
SignaturePartBean, MockMethodType, ParamsBuilder

Constructor Summary
MethodExpectationBean()
          Creates a new instance.
 
Method Summary
 void addParamBean(SignaturePartBean bean)
          Adds an entry to the list of SignaturePartBean objects used to create the expectation's method parameters.
 java.lang.String getMethodName()
          Returns the method name for the expectation.
 MockMethodType getMockMethodType()
          Returns the MockMethodType enum value for the expectation.
 java.util.ArrayList<SignaturePartBean> getParamBeans()
          Returns the list of SignaturePartBean objects used to create the expectation's method parameters.
 SignaturePartBean getResultBean()
          Returns the SignaturePartBean object used to create the expectation's result.
 java.lang.String isAnyParams()
          Returns the flag indicating whether the method will accept any parameters.
 void setAnyParams(java.lang.String anyParams)
          Sets the flag indicating whether the method will accept any parameters (if true, an AnyConstraintMatcher will be used to construct the method parameter).
 void setMethodName(java.lang.String methodName)
          Sets the method name for the expectation.
 void setMockMethod(java.lang.String mockMethodType)
          Assigns the MockMethodType enum value for the expectation.
 void setResultBean(SignaturePartBean resultBean)
          Sets the SignaturePartBean object used to create the expectation's result.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MethodExpectationBean

public MethodExpectationBean()
Creates a new instance.

Method Detail

setMethodName

public void setMethodName(java.lang.String methodName)
Sets the method name for the expectation.

Parameters:
methodName - the method name for the expectation.

getMethodName

public java.lang.String getMethodName()
Returns the method name for the expectation.

Returns:
the method name for the expectation.

setAnyParams

public void setAnyParams(java.lang.String anyParams)
Sets the flag indicating whether the method will accept any parameters (if true, an AnyConstraintMatcher will be used to construct the method parameter).

Parameters:
anyParams - the flag indicating whether the method will accept any parameters.

isAnyParams

public java.lang.String isAnyParams()
Returns the flag indicating whether the method will accept any parameters.

Returns:
the flag indicating whether the method will accept any parameters.

addParamBean

public void addParamBean(SignaturePartBean bean)
Adds an entry to the list of SignaturePartBean objects used to create the expectation's method parameters.

Parameters:
bean - an entry to add to the list of SignaturePartBean objects used to create the expectation's method parameters.
See Also:
SignaturePartBean

getParamBeans

public java.util.ArrayList<SignaturePartBean> getParamBeans()
Returns the list of SignaturePartBean objects used to create the expectation's method parameters.

Returns:
the list of SignaturePartBean objects used to create the expectation's method parameters.
See Also:
SignaturePartBean

setMockMethod

public void setMockMethod(java.lang.String mockMethodType)
Assigns the MockMethodType enum value for the expectation.

Parameters:
mockMethodType - a String used to look up the MockMethodType enum value for the expectation.

getMockMethodType

public MockMethodType getMockMethodType()
Returns the MockMethodType enum value for the expectation.

Returns:
the MockMethodType enum value for the expectation.

setResultBean

public void setResultBean(SignaturePartBean resultBean)
Sets the SignaturePartBean object used to create the expectation's result.

Parameters:
resultBean - athe SignaturePartBean object used to create the expectation's result.
See Also:
SignaturePartBean

getResultBean

public SignaturePartBean getResultBean()
Returns the SignaturePartBean object used to create the expectation's result.

Returns:
the SignaturePartBean object used to create the expectation's result.
See Also:
SignaturePartBean

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object