|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.easymock.EasyMockSupport
public class EasyMockSupport
Helper class to be used to keep tracks of mocks easily. See EasyMock documentation and SupportTest sample.
Example of usage:
public class SupportTest extends EasyMockSupport {
@Test
public void test() {
firstMock = createMock(A.class);
secondMock = createMock(B.class);
replayAll(); // put both mocks in replay mode
// ... use mocks ..
verifyAll(); // verify both mocks
}
}
| Field Summary | |
|---|---|
protected List<IMocksControl> |
controls
List of all controls created |
| Constructor Summary | |
|---|---|
EasyMockSupport()
|
|
| Method Summary | ||
|---|---|---|
IMocksControl |
createControl()
Creates a control, order checking is disabled by default. |
|
|
createMock(Class<T> toMock)
Creates a mock object that implements the given interface, order checking is disabled by default. |
|
|
createMock(Class<T> toMock,
ConstructorArgs constructorArgs,
Method... mockedMethods)
Deprecated. Use createMockBuilder(Class) instead |
|
|
createMock(Class<T> toMock,
Method... mockedMethods)
Deprecated. Use createMockBuilder(Class) instead |
|
|
createMock(String name,
Class<T> toMock)
Creates a mock object that implements the given interface, order checking is disabled by default. |
|
|
createMock(String name,
Class<T> toMock,
ConstructorArgs constructorArgs,
Method... mockedMethods)
Deprecated. Use createMockBuilder(Class) instead |
|
|
createMock(String name,
Class<T> toMock,
Method... mockedMethods)
Deprecated. Use createMockBuilder(Class) instead |
|
|
createMockBuilder(Class<T> toMock)
Create a mock builder allowing to create a partial mock for the given class or interface. |
|
IMocksControl |
createNiceControl()
Creates a control, order checking is disabled by default, and the mock objects created by this control will return 0,
null or false for unexpected invocations. |
|
|
createNiceMock(Class<T> toMock)
Creates a mock object that implements the given interface, order checking is disabled by default, and the mock object will return 0,
null or false for unexpected invocations. |
|
|
createNiceMock(Class<T> toMock,
ConstructorArgs constructorArgs,
Method... mockedMethods)
Deprecated. Use createMockBuilder(Class) instead |
|
|
createNiceMock(Class<T> toMock,
Method... mockedMethods)
Deprecated. Use createMockBuilder(Class) instead |
|
|
createNiceMock(String name,
Class<T> toMock)
Creates a mock object that implements the given interface, order checking is disabled by default, and the mock object will return 0,
null or false for unexpected invocations. |
|
|
createNiceMock(String name,
Class<T> toMock,
ConstructorArgs constructorArgs,
Method... mockedMethods)
Deprecated. Use createMockBuilder(Class) instead |
|
|
createNiceMock(String name,
Class<T> toMock,
Method... mockedMethods)
Deprecated. Use createMockBuilder(Class) instead |
|
IMocksControl |
createStrictControl()
Creates a control, order checking is enabled by default. |
|
|
createStrictMock(Class<T> toMock)
Creates a mock object that implements the given interface, order checking is enabled by default. |
|
|
createStrictMock(Class<T> toMock,
ConstructorArgs constructorArgs,
Method... mockedMethods)
Deprecated. Use createMockBuilder(Class) instead |
|
|
createStrictMock(Class<T> toMock,
Method... mockedMethods)
Deprecated. Use createMockBuilder(Class) instead |
|
|
createStrictMock(String name,
Class<T> toMock)
Creates a mock object that implements the given interface, order checking is enabled by default. |
|
|
createStrictMock(String name,
Class<T> toMock,
ConstructorArgs constructorArgs,
Method... mockedMethods)
Deprecated. Use createMockBuilder(Class) instead |
|
|
createStrictMock(String name,
Class<T> toMock,
Method... mockedMethods)
Deprecated. Use createMockBuilder(Class) instead |
|
void |
replayAll()
Switches all registered mock objects (more exactly: the controls of the mock objects) to replay mode. |
|
void |
resetAll()
Resets all registered mock objects (more exactly: the controls of the mock objects). |
|
void |
resetAllToDefault()
Resets all registered mock objects (more exactly: the controls of the mock objects) and turn them to a mock with default behavior. |
|
void |
resetAllToNice()
Resets all registered mock objects (more exactly: the controls of the mock objects) and turn them to a mock with nice behavior. |
|
void |
resetAllToStrict()
Resets all registered mock objects (more exactly: the controls of the mock objects) and turn them to a mock with strict behavior. |
|
void |
verifyAll()
Verifies all registered mock objects (more exactly: the controls of the mock objects). |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final List<IMocksControl> controls
| Constructor Detail |
|---|
public EasyMockSupport()
| Method Detail |
|---|
@Deprecated
public <T> T createStrictMock(Class<T> toMock,
Method... mockedMethods)
createMockBuilder(Class) instead
T - the class that the mock object should extend.toMock - the class that the mock object should extend.mockedMethods - methods that will be mocked, other methods will behave
normally
@Deprecated
public <T> T createStrictMock(String name,
Class<T> toMock,
Method... mockedMethods)
createMockBuilder(Class) instead
T - the class that the mock object should extend.name - the name of the mock object.toMock - the class that the mock object should extend.mockedMethods - methods that will be mocked, other methods will behave
normally
@Deprecated
public <T> T createStrictMock(Class<T> toMock,
ConstructorArgs constructorArgs,
Method... mockedMethods)
createMockBuilder(Class) instead
T - the class that the mock object should extend.toMock - the class that the mock object should extend.constructorArgs - constructor and parameters used to instantiate the mock.mockedMethods - methods that will be mocked, other methods will behave
normally
@Deprecated
public <T> T createStrictMock(String name,
Class<T> toMock,
ConstructorArgs constructorArgs,
Method... mockedMethods)
createMockBuilder(Class) instead
T - the class that the mock object should extend.name - the name of the mock object.toMock - the class that the mock object should extend.constructorArgs - constructor and parameters used to instantiate the mock.mockedMethods - methods that will be mocked, other methods will behave
normally
@Deprecated
public <T> T createMock(Class<T> toMock,
Method... mockedMethods)
createMockBuilder(Class) instead
T - the class that the mock object should extend.toMock - the class that the mock object should extend.mockedMethods - methods that will be mocked, other methods will behave
normally
@Deprecated
public <T> T createMock(String name,
Class<T> toMock,
Method... mockedMethods)
createMockBuilder(Class) instead
T - the class that the mock object should extend.name - the name of the mock object.toMock - the class that the mock object should extend.mockedMethods - methods that will be mocked, other methods will behave
normally
@Deprecated
public <T> T createMock(Class<T> toMock,
ConstructorArgs constructorArgs,
Method... mockedMethods)
createMockBuilder(Class) instead
T - the class that the mock object should extend.toMock - the class that the mock object should extend.constructorArgs - constructor and parameters used to instantiate the mock.mockedMethods - methods that will be mocked, other methods will behave
normally
@Deprecated
public <T> T createMock(String name,
Class<T> toMock,
ConstructorArgs constructorArgs,
Method... mockedMethods)
createMockBuilder(Class) instead
T - the class that the mock object should extend.name - the name of the mock object.toMock - the class that the mock object should extend.constructorArgs - constructor and parameters used to instantiate the mock.mockedMethods - methods that will be mocked, other methods will behave
normally
@Deprecated
public <T> T createNiceMock(Class<T> toMock,
Method... mockedMethods)
createMockBuilder(Class) instead
0,
null or false for unexpected invocations.
T - the class that the mock object should extend.toMock - the class that the mock object should extend.mockedMethods - methods that will be mocked, other methods will behave
normally
@Deprecated
public <T> T createNiceMock(String name,
Class<T> toMock,
Method... mockedMethods)
createMockBuilder(Class) instead
0,
null or false for unexpected invocations.
T - the class that the mock object should extend.name - the name of the mock object.toMock - the class that the mock object should extend.mockedMethods - methods that will be mocked, other methods will behave
normally
@Deprecated
public <T> T createNiceMock(Class<T> toMock,
ConstructorArgs constructorArgs,
Method... mockedMethods)
createMockBuilder(Class) instead
0,
null or false for unexpected invocations.
T - the class that the mock object should extend.toMock - the class that the mock object should extend.constructorArgs - constructor and parameters used to instantiate the mock.mockedMethods - methods that will be mocked, other methods will behave
normally
@Deprecated
public <T> T createNiceMock(String name,
Class<T> toMock,
ConstructorArgs constructorArgs,
Method... mockedMethods)
createMockBuilder(Class) instead
0,
null or false for unexpected invocations.
T - the class that the mock object should extend.name - the name of the mock object.toMock - the class that the mock object should extend.constructorArgs - constructor and parameters used to instantiate the mock.mockedMethods - methods that will be mocked, other methods will behave
normally
public <T> T createStrictMock(Class<T> toMock)
T - the interface that the mock object should implement.toMock - the class of the interface that the mock object should
implement.
public <T> T createStrictMock(String name,
Class<T> toMock)
T - the interface that the mock object should implement.name - the name of the mock object.toMock - the class of the interface that the mock object should
implement.
IllegalArgumentException - if the name is not a valid Java identifier.public <T> T createMock(Class<T> toMock)
T - the interface that the mock object should implement.toMock - the class of the interface that the mock object should
implement.
public <T> T createMock(String name,
Class<T> toMock)
T - the interface that the mock object should implement.name - the name of the mock object.toMock - the class of the interface that the mock object should
implement.
IllegalArgumentException - if the name is not a valid Java identifier.public <T> T createNiceMock(Class<T> toMock)
0,
null or false for unexpected invocations.
T - the interface that the mock object should implement.toMock - the class of the interface that the mock object should
implement.
public <T> T createNiceMock(String name,
Class<T> toMock)
0,
null or false for unexpected invocations.
T - the interface that the mock object should implement.name - the name of the mock object.toMock - the class of the interface that the mock object should
implement.
IllegalArgumentException - if the name is not a valid Java identifier.public IMocksControl createStrictControl()
public <T> IMockBuilder<T> createMockBuilder(Class<T> toMock)
T - the interface that the mock object should implement.toMock - the class of the interface that the mock object should
implement.
public IMocksControl createControl()
public IMocksControl createNiceControl()
0,
null or false for unexpected invocations.
public void replayAll()
public void resetAll()
public void verifyAll()
public void resetAllToNice()
public void resetAllToDefault()
public void resetAllToStrict()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||