|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jmock.Mockery
public class Mockery
A Mockery represents the context, or neighbourhood, of the object(s) under test. The neighbouring objects in that context are mocked out. The test specifies the expected interactions between the object(s) under test and its neighbours and the Mockery checks those expectations while the test is running.
Constructor Summary | |
---|---|
Mockery()
|
Method Summary | ||
---|---|---|
void |
addExpectation(Expectation expectation)
Adds an expected invocation that the object under test will perform upon objects in its context during the test. |
|
void |
assertIsSatisfied()
Fails the test if there are any expectations that have not been met. |
|
void |
checking(org.jmock.internal.ExpectationBuilder expectations)
Specifies the expected invocations that the object under test will perform upon objects in its context during the test. |
|
void |
describeTo(Description description)
|
|
|
mock(Class<T> typeToMock)
Creates a mock object of type typeToMock and generates a name for it. |
|
|
mock(Class<T> typeToMock,
String name)
Creates a mock object of type typeToMock with the given name. |
|
Sequence |
sequence(String name)
Returns a new sequence that is used to constrain the order in which expectations can occur. |
|
void |
setDefaultResultForType(Class<?> type,
Object result)
Sets the result returned for the given type when no return value has been explicitly specified in the expectation. |
|
void |
setExpectationErrorTranslator(ExpectationErrorTranslator expectationErrorTranslator)
Changes the expectation error translator used to translate expectation errors into errors that report test failures. |
|
void |
setImposteriser(Imposteriser imposteriser)
Changes the imposteriser used to adapt mock objects to the mocked type. |
|
void |
setNamingScheme(MockObjectNamingScheme namingScheme)
Changes the naming scheme used to generate names for mock objects that have not been explicitly named in the test. |
|
void |
setThreadingPolicy(ThreadingPolicy threadingPolicy)
Changes the policy by which the Mockery copes with multiple threads. |
|
States |
states(String name)
Returns a new state machine that is used to constrain the order in which expectations can occur. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Mockery()
Method Detail |
---|
public void setDefaultResultForType(Class<?> type, Object result)
type
- The type for which to return result.result
- The value to return when a method of return type type
is invoked for which an explicit return value has has not been specified.public void setImposteriser(Imposteriser imposteriser)
public void setNamingScheme(MockObjectNamingScheme namingScheme)
public void setExpectationErrorTranslator(ExpectationErrorTranslator expectationErrorTranslator)
ExpectationError
. Plug in a new expectation error
translator if you want your favourite test framework to report expectation
failures using its own error type.
public void setThreadingPolicy(ThreadingPolicy threadingPolicy)
Synchroniser
public <T> T mock(Class<T> typeToMock)
public <T> T mock(Class<T> typeToMock, String name)
public Sequence sequence(String name)
name
- The name of the sequence.
public States states(String name)
name
- The name of the state machine.
public void checking(org.jmock.internal.ExpectationBuilder expectations)
public void addExpectation(Expectation expectation)
public void assertIsSatisfied()
public void describeTo(Description description)
describeTo
in interface SelfDescribing
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |