See: Description
Interface | Description |
---|---|
Delegate<T> |
An empty interface to be used with the
Expectations.result field or the
Invocations#with(Delegate) method, allowing test code
to define varying invocation results or argument matching rules, respectively. |
Class | Description |
---|---|
Deencapsulation |
Provides utility methods that enable access to ("de-encapsulate") otherwise non-accessible fields, methods, and
constructors.
|
Expectations |
Used to record expectations on mocked types and their instances.
|
FullVerifications |
Same as
Verifications , but checking that all invocations from code under test are explicitly
verified, except for those already verified through other means. |
FullVerificationsInOrder |
A combination of
FullVerifications and VerificationsInOrder . |
Invocation |
A context object representing the current invocation to a mocked method/constructor, to be passed as the
first parameter of the corresponding delegate/mock method implementation.
|
MockUp<T> |
A base class used in the creation of a mock-up for a class or interface.
|
NonStrictExpectations |
Used to record non-strict expectations on mocked types and their instances.
|
StrictExpectations |
Used to record strict expectations on mocked types and their instances.
|
Verifications |
Used to verify a set of expectations on available mocked types and/or instances,
against the invocations which actually occurred during the test.
|
VerificationsInOrder |
Same as
Verifications , but checking that invocations from code under test occurred in the same order as the
verified expectations. |
Annotation Type | Description |
---|---|
Capturing |
Indicates a mock field or a mock parameter for which all classes extending/implementing the
mocked type will also get mocked.
|
Injectable |
Indicates that the value of a mock field or mock parameter will be an isolated mocked instance,
intended to be passed or injected into the code under test.
|
Mock |
Used inside a mock-up class to indicate a mock method whose implementation will
temporarily replace the implementation of a matching "real" method.
|
Mocked |
Indicates an instance field of a test class as being a mock field, or a parameter of a test method as a
mock parameter; in either case, the declared type of the field/parameter is a mocked type, whose
instances are mocked instances.
|
Tested |
Indicates a class to be tested, with optional automatic instantiation and/or automatic injection of dependencies.
|
Expectations
class provides an API for the record-replay model of recording expected
invocations which are later replayed and implicitly verified.
This API makes use of the @Mocked annotation (among others).
The Verifications
class extends the record-replay model to a record-replay-verify model,
where expectations that were not recorded can be verified explicitly after exercising the code under test
(ie, after the replay phase).
The MockUp<T>
generic class (where T
is the mocked type) allows
the definition of fake implementations for arbitrary classes or interfaces.
For a description with examples of the Expectations API, see the
"Mocking" chapter in the Tutorial.
For the Mockups API, see the "Faking" chapter.