org.xwiki.test.mockito
Class MockitoComponentManager

java.lang.Object
  extended by org.xwiki.component.embed.EmbeddableComponentManager
      extended by org.xwiki.test.TestComponentManager
          extended by org.xwiki.test.mockito.MockitoComponentManager
All Implemented Interfaces:
org.xwiki.component.manager.ComponentManager, org.xwiki.component.phase.Disposable

public class MockitoComponentManager
extends TestComponentManager

Helper class to make it extra simple to register Mock Components using Mockito.

Since:
5.1RC1
Version:
$Id: e4e1980b0f30e4c5b86bb1deddfbfd230b02ac76 $

Field Summary
 
Fields inherited from class org.xwiki.test.TestComponentManager
componentRegistrator
 
Constructor Summary
MockitoComponentManager()
           
 
Method Summary
<T> T
registerMockComponent(Type roleType)
          Registers a Mock component (using the default role hint).
<T> T
registerMockComponent(Type roleType, String roleHint)
          Registers a Mock component.
 
Methods inherited from class org.xwiki.test.TestComponentManager
initializeTest, registerComponent, registerComponent, registerComponent, registerMemoryConfigurationSource, shutdownTest
 
Methods inherited from class org.xwiki.component.embed.EmbeddableComponentManager
createLogger, dispose, getComponentDescriptor, getComponentDescriptorList, getComponentDescriptorList, getComponentEventManager, getComponentInstance, getInstance, getInstance, getInstanceList, getInstanceMap, getParent, hasComponent, hasComponent, initialize, registerComponent, registerComponent, release, setComponentEventManager, setParent, unregisterComponent, unregisterComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockitoComponentManager

public MockitoComponentManager()
Method Detail

registerMockComponent

public <T> T registerMockComponent(Type roleType,
                                   String roleHint)
                        throws Exception
Registers a Mock component.

Type Parameters:
T - the mock
Parameters:
roleType - the type of the component role to register
roleHint - the role hint of the component to register
Returns:
the mock
Throws:
Exception - in case of an error during registration

registerMockComponent

public <T> T registerMockComponent(Type roleType)
                        throws Exception
Registers a Mock component (using the default role hint).

Type Parameters:
T - the mock
Parameters:
roleType - the type of the component role to register
Returns:
the mock
Throws:
Exception - in case of an error during registration


Copyright © 2004–2014 XWiki. All rights reserved.