org.powermock.api.extension.listener
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
,
MockNice
or MockStrict
will have mock objects created for
them and injected to the fields.
It will only inject to fields that haven't been set before (i.e that are
null
).
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AnnotationEnabler
public AnnotationEnabler()
beforeTestMethod
public void beforeTestMethod(Object testInstance,
Method method,
Object[] arguments)
throws 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:
Exception
- If something unexpected occurs.
injectStrictMocks
protected void injectStrictMocks(Object testInstance)
throws Exception
- Throws:
Exception
injectNiceMocks
protected void injectNiceMocks(Object testInstance)
throws Exception
- Throws:
Exception
injectDefaultMocks
protected void injectDefaultMocks(Object testInstance)
throws Exception
- Throws:
Exception
getMockAnnotations
public Class<? extends Annotation>[] getMockAnnotations()
- Specified by:
getMockAnnotations
in interface AnnotationEnablerListener
- Returns:
- The mock annotations considered by this annotation enabler.
Copyright © 2007-2012. All Rights Reserved.