mockit.package-info Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmockit Show documentation
Show all versions of jmockit Show documentation
JMockit is a Java toolkit for automated developer testing.
It contains mocking/faking APIs and a code coverage tool, supporting both JUnit and TestNG.
The mocking APIs allow all kinds of Java code, without testability restrictions, to be tested
in isolation from selected dependencies.
/*
* Copyright (c) 2006 JMockit developers
* This file is subject to the terms of the MIT license (see LICENSE.txt).
*/
/**
* Provides the classes and annotations used when writing tests with the JMockit APIs.
*
* The {@linkplain mockit.Tested @Tested} annotation allows for the instantiation of classes under test, with the injection and/or recursive
* instantiation of dependencies.
* It can inject mocked instances when used in combination with the {@linkplain mockit.Injectable @Injectable} mocking annotation, and also
* inject non-mocked (real) instances when applied as @Tested(fullyInitialized = true).
* Non-mocked instances are either automatically created or obtained from other @Tested fields.
*
* The {@link mockit.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 {@linkplain mockit.Mocked @Mocked}, {@linkplain mockit.Injectable @Injectable}, and
* {@linkplain mockit.Capturing @Capturing} mocking annotations.
* The {@link mockit.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 {@link mockit.Invocation} class and the {@link mockit.Delegate} interface are also part of this API; they can be used for recording
* expectations with custom results, and for the implementation of custom argument matchers.
*
* {@linkplain mockit.MockUp MockUp<T>
} is a generic base class (where T is the type to be faked) which allows the
* definition of fake implementations for external classes.
* Methods in a fake class that take the place of the "real" methods in class T are indicated with the
* {@linkplain mockit.Mock @Mock} annotation.
* Such methods can also (optionally) have an {@link mockit.Invocation} parameter.
*
* Finally, the {@link mockit.Deencapsulation} class provides a few Reflection-based utility methods, for the rare cases where a
* private field 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.
*/
package mockit;