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 freely define 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 |
A set of expected and/or allowed method/constructor invocations on the mocked types/instances that
have been made available to the test through mock fields and/or mock parameters.
|
| FullVerifications |
Same as
Verifications, but checking that all invocations in the replay phase 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 mock method implementation.
|
| Mockit |
Provides static methods for the mocking and stubbing of arbitrary classes, according to specified mock
classes defined in test code.
|
| MockUp<T> |
A mock-up for a class or interface, to be used in state-based unit tests or to provide a
fake implementation for use in integration tests.
|
| NonStrictExpectations |
An
Expectations subclass where all expectations are automatically non-strict. |
| Verifications |
A set of expectations on mocked types and/or instances to be verified against the invocations which actually occurred
during the test.
|
| VerificationsInOrder |
Same as
Verifications, but checking that invocations in the replay phase occurred in the same order as
specified in this ordered verification block. |
| 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.
|
| Cascading |
Indicates a mocked type where the return types of mocked methods get automatically
mocked if and when an invocation to the method occurs, with a mocked instance being returned instead of
null. |
| Injectable |
Indicates an instance field of the test class or a parameter of the test method whose value will be an
isolated mocked instance, intended to be passed or injected into the code under test.
|
| Input | Deprecated
This annotation will be removed in a future release.
|
| Mock |
Used inside a mock class to indicate a mock method whose implementation will temporarily replace
the implementation of a matching "real" method.
|
| MockClass | Deprecated
This annotation will be removed in a future release.
|
| Mocked |
Indicates an instance field or test method parameter of a mocked type whose value will be
a mocked instance.
|
| NonStrict |
For tests using
Expectations, indicates a mock field/parameter of a non-strict mocked type,
whose expectations are allowed but not expected to occur (unless specified otherwise). |
| Tested |
Indicates a class to be tested in isolation from selected dependencies, with optional automatic instantiation and/or
automatic injection of dependencies.
|
| UsingMocksAndStubs |
Indicates one or more classes to be mocked or stubbed out for the whole test class or the whole
test suite (in the case of a JUnit 4 test suite definition class).
|
Expectations class provides an API for the traditional record-replay model of recording
expected invocations which are later replayed and implicitly verified.
This API makes use of the Mocked annotation.
The Verifications class, when combined with the NonStrictExpectations class or the
NonStrict annotation, extends the record-replay model to a record-replay-verify model, where
the record phase can be left empty, with expected invocations verified explicitly after exercising the code
under test (ie, after the replay phase).
The Mockit class contains a group of setUpMock/setUpMocks static methods that can be used to
set up state-oriented mock implementations.
They rely on the Mock and MockClass annotations.
The MockUp<T> generic class (where T is the mocked type) is a
convenient wrapper for common uses of the Mockit.setUpMock(Class, Object) and
Mockit.setUpMock(Object) methods, which allows the definition of in-line mocks for individual tests.© 2006-2013 Rogério Liesenfeld