public class AnnotationEnabler extends AbstractPowerMockTestListenerBase implements AnnotationEnablerListener
Before each test method all fields annotated with
Mock
, Mock
, Mock
MockNice
or MockStrict
will have mock objects created for
them and injected to the fields.
Also all fields annotated with TestSubject
will 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
).
Mock
,
Mock
,
TestSubject
Constructor and Description |
---|
AnnotationEnabler() |
Modifier and Type | Method and Description |
---|---|
void |
beforeTestMethod(java.lang.Object testInstance,
java.lang.reflect.Method method,
java.lang.Object[] arguments)
Provides an empty implementation.
|
protected EasyMockAnnotationSupport |
getEasyMockAnnotationSupport(java.lang.Object testInstance) |
java.lang.Class<? extends java.lang.annotation.Annotation>[] |
getMockAnnotations() |
afterTestMethod, afterTestSuiteEnded, beforeTestSuiteStarted
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
afterTestMethod, afterTestSuiteEnded, beforeTestSuiteStarted
public java.lang.Class<? extends java.lang.annotation.Annotation>[] getMockAnnotations()
getMockAnnotations
in interface AnnotationEnablerListener
public void beforeTestMethod(java.lang.Object testInstance, java.lang.reflect.Method method, java.lang.Object[] arguments) throws java.lang.Exception
AbstractPowerMockTestListenerBase
beforeTestMethod
in interface PowerMockTestListener
beforeTestMethod
in class AbstractPowerMockTestListenerBase
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
.java.lang.Exception
- If something unexpected occurs.protected EasyMockAnnotationSupport getEasyMockAnnotationSupport(java.lang.Object testInstance)