Provides utility methods that enable access to ("de-encapsulate") otherwise non-accessible fields.
Used to record expectations on mocked types and their instances.
A context object representing the current invocation to a mocked or faked method/constructor, to be passed as the first parameter of the corresponding delegate/fake method implementation.
A base class used in the creation of a fake for an external type, which is usually a class from some library or component used from the internal codebase of the system under test (SUT).
Used to verify a set of expectations on available mocked types and/or instances, against the invocations which actually occurred during the test.
Indicates a mock field or a mock parameter for which all classes extending/implementing the mocked type will also get mocked.
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.
Used inside a fake class to indicate a fake method whose implementation will temporarily replace the implementation of a matching "real" method.
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.
Indicates a class to be tested, with optional automatic instantiation and/or automatic injection of dependencies.
@Tested(fullyInitialized = true). Non-mocked instances are either automatically created or obtained from other
Expectationsclass 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, @Injectable, and @Capturing mocking annotations. The
Verificationsclass 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
Invocationclass and the
Delegateinterface are also part of this API; they can be used for recording expectations with custom results, and for the implementation of custom argument matchers.
MockUp<T>is a generic base class (where
Tis the type to be faked) which allows the definition of fake implementations for external classes or interfaces. Methods in a fake class that take the place of the "real" methods in class
Tare indicated with the @Mock annotation. Such methods can also (optionally) have an
Invocationparameter. Finally, the
Deencapsulationclass provides a few Reflection-based utility methods, for the rare cases where a
privatefield needs to be accessed. For a description with examples of the Mocking API, see the "Mocking" chapter in the Tutorial. For the Faking API, see the "Faking" chapter.