Package org.mockito
Annotation Type DoNotMock
-
@Target(TYPE) @Retention(RUNTIME) @Documented public @interface DoNotMock
Annotation representing a type that should not be mocked.When marking a type
@DoNotMock
, you should always point to alternative testing solutions such as standard fakes or other testing utilities. Mockito enforces@DoNotMock
with theDoNotMockEnforcer
. If you want to use a custom@DoNotMock
annotation, theDoNotMockEnforcer
will match on annotations with a type ending in "org.mockito.DoNotMock". You can thus place your custom annotation incom.my.package.org.mockito.DoNotMock
and Mockito will enforce that types annotated by@com.my.package.org.mockito.DoNotMock
can not be mocked.@DoNotMock(reason = "Use a real instance instead") class DoNotMockMe {}
-
-
Element Detail
-
reason
String reason
The reason why the annotated type should not be mocked.This should suggest alternative APIs to use for testing objects of this type.
- Default:
- "Create a real instance instead."
-
-