|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tapestry5.ioc.test.MockTester
public final class MockTester
Contains core logic used by TestBase
, allowing for mock objects to be used outside of a TestNG-based test
suite. A single standard mock control is used for all mock instances. The control does not care about
execution order, but will balk at any unexpected method invocations. This class is thread safe (it used a thread
local to store the mock control).
This class was originally in the tapestry-ioc module as was moved to tapestry-test; the package name was not changed to ensure backwards compatibility.
Constructor Summary | |
---|---|
MockTester()
|
Method Summary | ||
---|---|---|
void |
cleanup()
Invoked after an individual unit test (i.e., a test method invocation) to discard the mock control. |
|
org.easymock.IMocksControl |
getMocksControl()
|
|
|
newMock(Class<T> mockClass)
Creates a new mock object of the indicated type. |
|
void |
replay()
Switches each mock object created by newMock(Class) into replay mode (out of the initial training
mode). |
|
void |
verify()
Verifies that all trained methods have been invoked on all mock objects (created by newMock(Class) , then
switches each mock object back to training mode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MockTester()
Method Detail |
---|
public void cleanup()
public org.easymock.IMocksControl getMocksControl()
public <T> T newMock(Class<T> mockClass)
T
- the type of the mock objectmockClass
- the class to mock
public void replay()
newMock(Class)
into replay mode (out of the initial training
mode).
public void verify()
newMock(Class)
, then
switches each mock object back to training mode.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |