Class DefaultMockitoPlugins
- java.lang.Object
-
- org.mockito.internal.configuration.plugins.DefaultMockitoPlugins
-
- All Implemented Interfaces:
MockitoPlugins
public class DefaultMockitoPlugins extends java.lang.Object implements MockitoPlugins
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<java.lang.String,java.lang.String>
DEFAULT_PLUGINS
(package private) static java.lang.String
INLINE_ALIAS
static java.util.Set<java.lang.String>
MEMBER_ACCESSOR_ALIASES
static java.util.Set<java.lang.String>
MOCK_MAKER_ALIASES
(package private) static java.lang.String
MODULE_ALIAS
(package private) static java.lang.String
PROXY_ALIAS
(package private) static java.lang.String
REFLECTION_ALIAS
(package private) static java.lang.String
SUBCLASS_ALIAS
-
Constructor Summary
Constructors Constructor Description DefaultMockitoPlugins()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private <T> T
create(java.lang.Class<T> pluginType, java.lang.String className)
Creates an instance of given plugin type, using specific implementation class.<T> T
getDefaultPlugin(java.lang.Class<T> pluginType)
Returns the default plugin implementation used by Mockito.static java.lang.String
getDefaultPluginClass(java.lang.String classOrAlias)
MockMaker
getInlineMockMaker()
Returns inline mock maker, an optional mock maker that is bundled with Mockito distribution.MockMaker
getMockMaker(java.lang.String mockMaker)
ReturnsMockMaker
instance used by Mockito with the passed namemockMaker
.
-
-
-
Field Detail
-
DEFAULT_PLUGINS
private static final java.util.Map<java.lang.String,java.lang.String> DEFAULT_PLUGINS
-
INLINE_ALIAS
static final java.lang.String INLINE_ALIAS
- See Also:
- Constant Field Values
-
PROXY_ALIAS
static final java.lang.String PROXY_ALIAS
- See Also:
- Constant Field Values
-
SUBCLASS_ALIAS
static final java.lang.String SUBCLASS_ALIAS
- See Also:
- Constant Field Values
-
MOCK_MAKER_ALIASES
public static final java.util.Set<java.lang.String> MOCK_MAKER_ALIASES
-
MODULE_ALIAS
static final java.lang.String MODULE_ALIAS
- See Also:
- Constant Field Values
-
REFLECTION_ALIAS
static final java.lang.String REFLECTION_ALIAS
- See Also:
- Constant Field Values
-
MEMBER_ACCESSOR_ALIASES
public static final java.util.Set<java.lang.String> MEMBER_ACCESSOR_ALIASES
-
-
Method Detail
-
getDefaultPlugin
public <T> T getDefaultPlugin(java.lang.Class<T> pluginType)
Description copied from interface:MockitoPlugins
Returns the default plugin implementation used by Mockito. Mockito plugins are stateless so it is recommended to keep hold of the returned plugin implementation rather than calling this method multiple times. Each time this method is called, new instance of the plugin is created.- Specified by:
getDefaultPlugin
in interfaceMockitoPlugins
- Parameters:
pluginType
- type of the plugin, for exampleMockMaker
.- Returns:
- the plugin instance
-
getDefaultPluginClass
public static java.lang.String getDefaultPluginClass(java.lang.String classOrAlias)
-
create
private <T> T create(java.lang.Class<T> pluginType, java.lang.String className)
Creates an instance of given plugin type, using specific implementation class.
-
getInlineMockMaker
public MockMaker getInlineMockMaker()
Description copied from interface:MockitoPlugins
Returns inline mock maker, an optional mock maker that is bundled with Mockito distribution. This method is needed becauseMockitoPlugins.getDefaultPlugin(Class)
does not provide an instance of inline mock maker. Creates new instance each time is called so it is recommended to keep hold of the resulting object for future invocations. For more information about inline mock maker see the javadoc for mainMockito
class.- Specified by:
getInlineMockMaker
in interfaceMockitoPlugins
- Returns:
- instance of inline mock maker
-
getMockMaker
public MockMaker getMockMaker(java.lang.String mockMaker)
Description copied from interface:MockitoPlugins
ReturnsMockMaker
instance used by Mockito with the passed namemockMaker
.This will return the instance used by Mockito itself, not a new instance of it.
This method can be used to increase the interop of mocks created by Mockito and other libraries using Mockito mock maker API.
- Specified by:
getMockMaker
in interfaceMockitoPlugins
- Parameters:
mockMaker
- the name of the mock maker ornull
to retrieve the default mock maker- Returns:
- instance of the mock maker
-
-