org.xwiki.test.mockito
Class MockitoComponentManagerRule

java.lang.Object
  extended by org.xwiki.component.embed.EmbeddableComponentManager
      extended by org.xwiki.test.TestComponentManager
          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
Direct Known Subclasses:
MockitoComponentMockingRule

public class MockitoComponentManagerRule
extends ComponentManagerRule

JUnit MethodRule to make it extra simple to register Mock Components using Mockito.

Since:
4.3.1
Version:
$Id: bd309c5d272d75c1e322549f6f611f38909c06ce $

Field Summary
 
Fields inherited from class org.xwiki.test.TestComponentManager
componentRegistrator
 
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
after, apply, before
 
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

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–2014 XWiki. All rights reserved.