net.sourceforge.xconf.toolbox.easymock
Class ClassMockFactory

java.lang.Object
  extended by net.sourceforge.xconf.toolbox.easymock.ClassMockFactory
All Implemented Interfaces:
MockFactory

public class ClassMockFactory
extends Object
implements MockFactory

Wraps the org.easymock.classextension.EasyMock class to create mock objects for concrete classes.

Author:
Tom Czarniecki
See Also:
MockObjectFactory

Constructor Summary
ClassMockFactory()
           
 
Method Summary
 void clear()
          Unregisters all mock objects managed by this factory.
<T> T
createMock(Class<T> toMock)
          Creates and registers an EasyMock mock object with default behaviour semantics for the given class.
<T> T
createNiceMock(Class<T> toMock)
          Creates and registers an EasyMock mock object with nice behaviour semantics for the given class.
<T> T
createStrictMock(Class<T> toMock)
          Creates and registers an EasyMock mock object with strict behaviour semantics for the given class.
 void register(Object mock)
          Register a mock object to be managed by this factory.
 void replay()
          Invokes EasyMock.replay() on all mock objects created by this factory.
 void reset()
          Invokes EasyMock.reset() on all mock objects created by this factory.
 void verify()
          Invokes EasyMock.verify() on all mock objects created by this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassMockFactory

public ClassMockFactory()
Method Detail

createMock

public <T> T createMock(Class<T> toMock)
Description copied from interface: MockFactory
Creates and registers an EasyMock mock object with default behaviour semantics for the given class.

Specified by:
createMock in interface MockFactory

createNiceMock

public <T> T createNiceMock(Class<T> toMock)
Description copied from interface: MockFactory
Creates and registers an EasyMock mock object with nice behaviour semantics for the given class.

Specified by:
createNiceMock in interface MockFactory

createStrictMock

public <T> T createStrictMock(Class<T> toMock)
Description copied from interface: MockFactory
Creates and registers an EasyMock mock object with strict behaviour semantics for the given class.

Specified by:
createStrictMock in interface MockFactory

register

public void register(Object mock)
Description copied from interface: MockFactory
Register a mock object to be managed by this factory. This allows you to create your own mock object and then register it with this factory for replay, reset and verify invocation.

Specified by:
register in interface MockFactory

replay

public void replay()
Description copied from interface: MockFactory
Invokes EasyMock.replay() on all mock objects created by this factory.

Specified by:
replay in interface MockFactory

reset

public void reset()
Description copied from interface: MockFactory
Invokes EasyMock.reset() on all mock objects created by this factory.

Specified by:
reset in interface MockFactory

verify

public void verify()
Description copied from interface: MockFactory
Invokes EasyMock.verify() on all mock objects created by this factory.

Specified by:
verify in interface MockFactory

clear

public void clear()
Description copied from interface: MockFactory
Unregisters all mock objects managed by this factory.

Specified by:
clear in interface MockFactory


Copyright © 2007 Thomas Czarniecki. All Rights Reserved.