org.mockito.plugins.package.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockito-core Show documentation
Show all versions of mockito-core Show documentation
Mock objects library for java
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 {@link java.util.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
the MockMaker
.
-
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 {@link ClassLoader#getResource} mechanism.