Class AnnotationEnabler
- java.lang.Object
-
- org.powermock.core.spi.support.AbstractPowerMockTestListenerBase
-
- org.powermock.api.extension.listener.AnnotationEnabler
-
- All Implemented Interfaces:
AnnotationEnablerListener,PowerMockTestListener
- Direct Known Subclasses:
AnnotationEnabler,AnnotationEnabler
public class AnnotationEnabler extends AbstractPowerMockTestListenerBase implements AnnotationEnablerListener
Before each test method all fields annotated with
Mock,Mock,MockMockNiceorMockStrictwill have mock objects created for them and injected to the fields.Also all fields annotated with
TestSubjectwill be processed and mocks are injected to fields object, if these fields not null.It will only inject to fields that haven't been set before (i.e that are
null).- See Also:
Mock,Mock,TestSubject
-
-
Constructor Summary
Constructors Constructor Description AnnotationEnabler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeforeTestMethod(java.lang.Object testInstance, java.lang.reflect.Method method, java.lang.Object[] arguments)Provides an empty implementation.protected EasyMockAnnotationSupportgetEasyMockAnnotationSupport(java.lang.Object testInstance)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
-
-
-
-
Method Detail
-
getMockAnnotations
public java.lang.Class<? extends java.lang.annotation.Annotation>[] getMockAnnotations()
- Specified by:
getMockAnnotationsin interfaceAnnotationEnablerListener- Returns:
- The mock annotations considered by this annotation enabler.
-
beforeTestMethod
public void beforeTestMethod(java.lang.Object testInstance, java.lang.reflect.Method method, java.lang.Object[] arguments) throws java.lang.ExceptionDescription copied from class:AbstractPowerMockTestListenerBaseProvides an empty implementation.- Specified by:
beforeTestMethodin interfacePowerMockTestListener- Overrides:
beforeTestMethodin classAbstractPowerMockTestListenerBase- 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 nevernull.- Throws:
java.lang.Exception- If something unexpected occurs.
-
getEasyMockAnnotationSupport
protected EasyMockAnnotationSupport getEasyMockAnnotationSupport(java.lang.Object testInstance)
-
-