org.xwiki.test.mockito
Class MockitoComponentManagerRule

java.lang.Object
  extended by org.xwiki.component.embed.EmbeddableComponentManager
      extended by org.xwiki.test.ComponentManagerRule
          extended by org.xwiki.test.mockito.MockitoComponentManagerRule
All Implemented Interfaces:
org.junit.rules.MethodRule, org.xwiki.component.manager.ComponentManager, org.xwiki.component.phase.Disposable

public class MockitoComponentManagerRule
extends ComponentManagerRule

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

Since:
4.3.1
Version:
$Id: 2aa978d009c355274519c794f4a49b9abe999f7c $

Constructor Summary
MockitoComponentManagerRule()
           
 
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.ComponentManagerRule
apply, registerComponent, registerComponent, registerMemoryConfigurationSource
 
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

MockitoComponentManagerRule

public MockitoComponentManagerRule()
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-2013 XWiki. All Rights Reserved.