net.sourceforge.xconf.toolbox.mockcontrol
Class MockObjectFactory

java.lang.Object
  extended by net.sourceforge.xconf.toolbox.mockcontrol.MockObjectFactory

public class MockObjectFactory
extends Object

This class wraps a MockFactory instance and allows you to easily keep track of MockControls for mock objects without needing to create a test variable for each control.

Author:
Tom Czarniecki
See Also:
MockControlFactory

Constructor Summary
MockObjectFactory()
           
 
Method Summary
 void clear()
          Clear all created MockControls and mock objects.
 org.easymock.MockControl control(Object mockObject)
          Returns the MockControl instance associated with the given mock object.
 Object createMock(Class clazz)
          Creates a default mock object for the given class.
 Object createNiceMock(Class clazz)
          Creates a nice mock object for the given class.
 Object createStrictMock(Class clazz)
          Creates a strict mock object for the given class.
 void replay()
          Invokes replay() on all MockControls created by this factory.
 void reset()
          Invokes reset() on all MockControls created by this factory.
 void verify()
          Invokes verify() on all MockControls created by this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockObjectFactory

public MockObjectFactory()
Method Detail

createMock

public Object createMock(Class clazz)
Creates a default mock object for the given class. You can retrieve the MockControl for this mock object by passing the returned object to the control(Object) method.

See Also:
MockFactory.createControl(Class)

createNiceMock

public Object createNiceMock(Class clazz)
Creates a nice mock object for the given class. You can retrieve the MockControl for this mock object by passing the returned object to the control(Object) method.

See Also:
MockFactory.createNiceControl(Class)

createStrictMock

public Object createStrictMock(Class clazz)
Creates a strict mock object for the given class. You can retrieve the MockControl for this mock object by passing the returned object to the control(Object) method.

See Also:
MockFactory.createStrictControl(Class)

control

public org.easymock.MockControl control(Object mockObject)
Returns the MockControl instance associated with the given mock object. This mock object must have been created by one of the mock object creation methods above.


replay

public void replay()
Invokes replay() on all MockControls created by this factory.


reset

public void reset()
Invokes reset() on all MockControls created by this factory.


verify

public void verify()
Invokes verify() on all MockControls created by this factory.


clear

public void clear()
Clear all created MockControls and mock objects.



Copyright © 2007 Thomas Czarniecki. All Rights Reserved.