Package org.powermock.tests.utils.impl
Class PowerMockTestNotifierImpl
- java.lang.Object
-
- org.powermock.tests.utils.impl.PowerMockTestNotifierImpl
-
- All Implemented Interfaces:
PowerMockTestNotifier
public class PowerMockTestNotifierImpl extends java.lang.Object implements PowerMockTestNotifier
Utility class that may be used by PowerMock test runners to notify listeners. Uses theMockRepositoryto set and get state.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringERROR_MESSAGE_TEMPLATEprivate PowerMockTestListener[]powerMockTestListeners
-
Constructor Summary
Constructors Constructor Description PowerMockTestNotifierImpl(PowerMockTestListener[] powerMockTestListeners)Create a new instance with the following parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidnotifyAfterTestMethod(boolean successful)Notifies all listeners with the "after test method ended" event.voidnotifyAfterTestMethod(java.lang.Object testInstance, java.lang.reflect.Method method, java.lang.Object[] arguments, TestMethodResult testResult)Notifies all listeners with the "after test method ended" event.voidnotifyAfterTestSuiteEnded(java.lang.Class<?> testClass, java.lang.reflect.Method[] methods, TestSuiteResult testResult)Notifies all listeners with the "after test suite ended" event.voidnotifyBeforeTestMethod(java.lang.Object testInstance, java.lang.reflect.Method testMethod, java.lang.Object[] arguments)Notifies all listeners with the "before test method started" event.voidnotifyBeforeTestSuiteStarted(java.lang.Class<?> testClass, java.lang.reflect.Method[] testMethods)Notifies all listeners with the "before test suite started" event.
-
-
-
Field Detail
-
ERROR_MESSAGE_TEMPLATE
private static final java.lang.String ERROR_MESSAGE_TEMPLATE
- See Also:
- Constant Field Values
-
powerMockTestListeners
private final PowerMockTestListener[] powerMockTestListeners
-
-
Constructor Detail
-
PowerMockTestNotifierImpl
public PowerMockTestNotifierImpl(PowerMockTestListener[] powerMockTestListeners)
Create a new instance with the following parameters.- Parameters:
powerMockTestListeners- The PowerMock listeners that will be notified.
-
-
Method Detail
-
notifyAfterTestMethod
public void notifyAfterTestMethod(java.lang.Object testInstance, java.lang.reflect.Method method, java.lang.Object[] arguments, TestMethodResult testResult)Description copied from interface:PowerMockTestNotifierNotifies all listeners with the "after test method ended" event.- Specified by:
notifyAfterTestMethodin interfacePowerMockTestNotifier- Parameters:
testInstance- instance of testmethod- test method to be executedarguments- arguments of test methodstestResult- result of running of test
-
notifyAfterTestSuiteEnded
public void notifyAfterTestSuiteEnded(java.lang.Class<?> testClass, java.lang.reflect.Method[] methods, TestSuiteResult testResult)Description copied from interface:PowerMockTestNotifierNotifies all listeners with the "after test suite ended" event.- Specified by:
notifyAfterTestSuiteEndedin interfacePowerMockTestNotifier- Parameters:
testClass- class of test suitemethods- test case methodstestResult- result of running of test
-
notifyBeforeTestMethod
public void notifyBeforeTestMethod(java.lang.Object testInstance, java.lang.reflect.Method testMethod, java.lang.Object[] arguments)Description copied from interface:PowerMockTestNotifierNotifies all listeners with the "before test method started" event.- Specified by:
notifyBeforeTestMethodin interfacePowerMockTestNotifier- Parameters:
testInstance- instance of testtestMethod- test method to be executedarguments- arguments of test methods
-
notifyBeforeTestSuiteStarted
public void notifyBeforeTestSuiteStarted(java.lang.Class<?> testClass, java.lang.reflect.Method[] testMethods)Description copied from interface:PowerMockTestNotifierNotifies all listeners with the "before test suite started" event.- Specified by:
notifyBeforeTestSuiteStartedin interfacePowerMockTestNotifier- Parameters:
testClass- class of test suitetestMethods- test case methods
-
notifyAfterTestMethod
public void notifyAfterTestMethod(boolean successful)
Description copied from interface:PowerMockTestNotifierNotifies all listeners with the "after test method ended" event. Uses some state-store to get the needed state. For this method to workPowerMockTestNotifier.notifyBeforeTestMethod(Object, Method, Object[])must have been called before this method. Otherwise revert to using thePowerMockTestNotifier.notifyAfterTestMethod(Object, Method, Object[], TestMethodResult)method.- Specified by:
notifyAfterTestMethodin interfacePowerMockTestNotifier- Parameters:
successful-trueif the test was successful,falseotherwise.
-
-