Package org.mockito.plugins
Mockito plugins allow customization of behavior.
For example, it is useful for Android integration via dexmaker.
See examples in docs for MockMaker.
The plugin mechanism of mockito works in a similar way as the ServiceLoader
, however instead of
looking in the META-INF
directory, Mockito will look in mockito-extensions
directory.
The reason for that is that Android SDK strips jars from the META-INF
directory when creating an APK.
For example :
-
Create implementation itself, for example
org.awesome.mockito.AwesomeMockMaker
that extends theMockMaker
. -
A file "
mockito-extensions/org.mockito.plugins.MockMaker
". The content of this file is exactly a one line with the qualified name:org.awesome.mockito.AwesomeMockMaker
.
Note that if several mockito-extensions/org.mockito.plugins.MockMaker
files exists in the classpath
Mockito will only use the first returned by the standard ClassLoader.getResource
mechanism.
-
Interface Summary Interface Description AnnotationEngine Configures test via annotations.DoNotMockEnforcer Enforcer that is applied to every type in the type hierarchy of the class-to-be-mocked.InlineMockMaker Extension toMockMaker
for mock makers that changes inline method implementations and need keep track of created mock objects.InstantiatorProvider2 Mockito will invoke this interface in order to fetch an instance instantiator provider.MemberAccessor A member accessor is responsible for invoking methods, constructors and for setting and reading field values.MemberAccessor.ConstructionDispatcher MemberAccessor.OnConstruction MockitoLogger Mockito logger.MockitoPlugins Instance of this interface is available viaMockitoFramework.getPlugins()
.MockMaker The facility to create mocks.MockMaker.ConstructionMockControl<T> MockMaker.StaticMockControl<T> MockMaker.TypeMockability Carries the mockability informationMockResolver A mock resolver offers an opportunity to resolve a mock from any instance that is provided to theMockito
-DSL.PluginSwitch Allows switching off the plugins that are discovered on classpath.StackTraceCleanerProvider An extension point to register customStackTraceCleaner
. -
Class Summary Class Description AnnotationEngine.NoAction