org.powermock.api.extension.listener
Class AnnotationEnabler

java.lang.Object
  extended by org.powermock.core.spi.support.AbstractPowerMockTestListenerBase
      extended by org.powermock.api.extension.listener.AnnotationEnabler
All Implemented Interfaces:
AnnotationEnablerListener, PowerMockTestListener
Direct Known Subclasses:
AnnotationEnabler

public class AnnotationEnabler
extends AbstractPowerMockTestListenerBase
implements AnnotationEnablerListener

Before each test method all fields annotated with MockitoAnnotations.Mock, Mock or MockitoAnnotations.Mock have mock objects created for them and injected to the fields. It will also delegate to a special implementation of the InjectingAnnotationEngine in Mockito which inject's spies, captors etc.

It will only inject to fields that haven't been set before (i.e that are null).


Constructor Summary
AnnotationEnabler()
           
 
Method Summary
 void beforeTestMethod(java.lang.Object testInstance, java.lang.reflect.Method method, java.lang.Object[] arguments)
          Provides an empty implementation.
 java.lang.Class<? extends java.lang.annotation.Annotation>[] getMockAnnotations()
           
 
Methods inherited from class org.powermock.core.spi.support.AbstractPowerMockTestListenerBase
afterTestMethod, afterTestSuiteEnded, beforeTestSuiteStarted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.powermock.core.spi.PowerMockTestListener
afterTestMethod, afterTestSuiteEnded, beforeTestSuiteStarted
 

Constructor Detail

AnnotationEnabler

public AnnotationEnabler()
Method Detail

beforeTestMethod

public void beforeTestMethod(java.lang.Object testInstance,
                             java.lang.reflect.Method method,
                             java.lang.Object[] arguments)
                      throws java.lang.Exception
Description copied from class: AbstractPowerMockTestListenerBase
Provides an empty implementation.

Specified by:
beforeTestMethod in interface PowerMockTestListener
Overrides:
beforeTestMethod in class AbstractPowerMockTestListenerBase
Parameters:
testInstance - The test case instance.
method - The test method that is currently executed.
arguments - The arguments passed to the test method if any. May be an empty array but never null.
Throws:
java.lang.Exception - If something unexpected occurs.

getMockAnnotations

public java.lang.Class<? extends java.lang.annotation.Annotation>[] getMockAnnotations()
Specified by:
getMockAnnotations in interface AnnotationEnablerListener
Returns:
The mock annotations considered by this annotation enabler.