@Incubating public interface PluginSwitch
Mockito will invoke this interface in order to select whether a plugin is enabled or not.
When a particular plugin is switched off, the default Mockito behavior is used.
For example, if Android's dexmaker MockMaker is switched off,
Mockito default MockMaker implementation is used
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
The reason for that is that Android SDK strips jar from the
META-INF directory when creating an APK.
org.awesome.mockito.AwesomeMockMaker that extends the
mockito-extensions/org.mockito.plugins.MockMaker". The content of this file is
exactly a one line with the qualified name:
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
So just create a custom implementation of
PluginSwitch and place the qualified name in the following file
boolean isEnabled(String pluginClassName)
PluginSwitch implementation itself).
If no custom plugins are discovered this method is not invoked.