|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sourceforge.xconf.toolbox.easymock.MockObjectFactory
public class MockObjectFactory
This class wraps both an InterfaceMockFactory and a ClassMockFactory, and dynamically figures
out which MockFactory to use to create a mock object for a given class. If you don't have the EasyMock
class extension library in your classpath, you will not be able to create mock objects for concrete classes,
however you will still be able to create mock objects for interfaces as long as you have the basic EasyMock
library in your classpath.
InterfaceMockFactory,
ClassMockFactory| Constructor Summary | |
|---|---|
MockObjectFactory()
|
|
| Method Summary | ||
|---|---|---|
void |
clear()
Clear all created mock objects. |
|
|
createMock(Class<T> toMock)
Creates an EasyMock mock object with default behaviour semantics for the given class. |
|
|
createNiceMock(Class<T> toMock)
Creates an EasyMock mock object with nice behaviour semantics for the given class. |
|
|
createStrictMock(Class<T> toMock)
Creates 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 |
|---|
public MockObjectFactory()
| Method Detail |
|---|
public <T> T createMock(Class<T> toMock)
org.easymock.classextension.EasyMock
library is available, this method will attempt to create a mock class object.
createMock in interface MockFactoryFactoryException - If given a concrete class to mock and the EasyMock class extension library
is not available.public <T> T createNiceMock(Class<T> toMock)
org.easymock.classextension.EasyMock
library is available, this method will attempt to create a mock class object.
createNiceMock in interface MockFactoryFactoryException - If given a concrete class to mock and the EasyMock class extension library
is not available.public <T> T createStrictMock(Class<T> toMock)
org.easymock.classextension.EasyMock
library is available, this method will attempt to create a mock class object.
createStrictMock in interface MockFactoryFactoryException - If given a concrete class to mock and the EasyMock class extension library
is not available.public void replay()
replay in interface MockFactorypublic void reset()
reset in interface MockFactorypublic void verify()
verify in interface MockFactorypublic void clear()
clear in interface MockFactorypublic void register(Object mock)
register in interface MockFactoryFactoryException - If given a class mock object and the EasyMock class extension library
is not available.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||