Annotation Interface MockObject


@Documented @Target(TYPE) @Retention(RUNTIME) public @interface MockObject
This annotation is used to mark a class as a mock object.
Mock objects are used to simulate real objects in tests.
They are used to test the behavior of other objects.

Mock objects should be only used in tests.
The mock object must not be tested itself,
it is assumed that the mock object works correctly.

A mock object must always be a non abstract class.
The class must be private or package-private.
In the case of package-private the class must also be final.

A mocked class must also be prefixed with "Mocked" or
suffixed with "Mock" to indicate that it is a mock object.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    @NotNull Class<?>
    Returns the class mocked by this mock object.
  • Element Details

    • value

      @NotNull @NotNull Class<?> value
      Returns the class mocked by this mock object.
      Returns:
      The class