org.mockcentral.server
Class MockObjectSetup

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

public class MockObjectSetup
extends java.lang.Object

Class used for constructing Mock Object instances. The Mock Object name, class name and JNDI name (if used) are assigned when this class is built from the configuration file. When this instance is loaded into its enclosing Fixture, the Mock Object is instantiated and the list of MethodExpectationBean instances is processed to add method expectations to it.

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:
MethodExpectationBean

Constructor Summary
MockObjectSetup()
          Creates a new instance.
 
Method Summary
 void addMethodExpectation(MethodExpectationBean bean)
          Adds an entry to the list of all the MethodExpectationBean instances used to create the Mock Object.
 com.mockobjects.dynamic.Mock createMockObject()
          Creates the Mock Object and adds method expectations to it using the list of MethodExpectationBean instances.
 java.lang.String getJndiName()
          Returns the name (if any) under which the proxy will be bound in the MockCentralTestingContext.
 java.lang.String getMockObjectName()
          Returns the name identifying the Mock Object.
 void setClassName(java.lang.String className)
          Sets the class name of the Mock Object.
 void setFixtureName(java.lang.String fixtureName)
          Sets the current Fixture name.
 void setJndiName(java.lang.String jndiName)
          Sets the name (if any) under which the proxy will be bound in the MockCentralTestingContext.
 void setMockObjectName(java.lang.String mockObjectName)
          Sets the name identifying the Mock Object.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MockObjectSetup

public MockObjectSetup()
Creates a new instance.

Method Detail

setFixtureName

public void setFixtureName(java.lang.String fixtureName)
Sets the current Fixture name.

Parameters:
fixtureName - the current Fixture name.

setMockObjectName

public void setMockObjectName(java.lang.String mockObjectName)
Sets the name identifying the Mock Object.

Parameters:
mockObjectName - the name identifying the Mock Object.

getMockObjectName

public java.lang.String getMockObjectName()
Returns the name identifying the Mock Object.

Returns:
the name identifying the Mock Object.

setClassName

public void setClassName(java.lang.String className)
Sets the class name of the Mock Object.

Parameters:
className - the class name of the Mock Object.

setJndiName

public void setJndiName(java.lang.String jndiName)
Sets the name (if any) under which the proxy will be bound in the MockCentralTestingContext.

Parameters:
jndiName - the name (if any) under which the proxy will be bound in the MockCentralTestingContext.

getJndiName

public java.lang.String getJndiName()
Returns the name (if any) under which the proxy will be bound in the MockCentralTestingContext.

Returns:
the name (if any) under which the proxy will be bound in the MockCentralTestingContext.

addMethodExpectation

public void addMethodExpectation(MethodExpectationBean bean)
Adds an entry to the list of all the MethodExpectationBean instances used to create the Mock Object.

Parameters:
bean - the MethodExpectationBean to add to the list.
See Also:
MethodExpectationBean

createMockObject

public com.mockobjects.dynamic.Mock createMockObject()
                                              throws UnknownProxyException,
                                                     MockCentralServerException
Creates the Mock Object and adds method expectations to it using the list of MethodExpectationBean instances.

Returns:
the newly created Mock Object
Throws:
UnknownProxyException
MockCentralServerException
See Also:
MethodExpectationBean

toString

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