Package org.powermock.tests.utils.impl
Class PowerMockTestNotifierImpl
java.lang.Object
org.powermock.tests.utils.impl.PowerMockTestNotifierImpl
- All Implemented Interfaces:
PowerMockTestNotifier
Utility class that may be used by PowerMock test runners to notify listeners.
Uses the
MockRepository to set and get state.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate final PowerMockTestListener[] -
Constructor Summary
ConstructorsConstructorDescriptionPowerMockTestNotifierImpl(PowerMockTestListener[] powerMockTestListeners) Create a new instance with the following parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidnotifyAfterTestMethod(boolean successful) Notifies all listeners with the "after test method ended" event.voidnotifyAfterTestMethod(Object testInstance, Method method, Object[] arguments, TestMethodResult testResult) Notifies all listeners with the "after test method ended" event.voidnotifyAfterTestSuiteEnded(Class<?> testClass, Method[] methods, TestSuiteResult testResult) Notifies all listeners with the "after test suite ended" event.voidnotifyBeforeTestMethod(Object testInstance, Method testMethod, Object[] arguments) Notifies all listeners with the "before test method started" event.voidnotifyBeforeTestSuiteStarted(Class<?> testClass, Method[] testMethods) Notifies all listeners with the "before test suite started" event.
-
Field Details
-
ERROR_MESSAGE_TEMPLATE
- See Also:
-
powerMockTestListeners
-
-
Constructor Details
-
PowerMockTestNotifierImpl
Create a new instance with the following parameters.- Parameters:
powerMockTestListeners- The PowerMock listeners that will be notified.
-
-
Method Details
-
notifyAfterTestMethod
public void notifyAfterTestMethod(Object testInstance, Method method, Object[] arguments, TestMethodResult testResult) Notifies all listeners with the "after test method ended" event.- Specified by:
notifyAfterTestMethodin interfacePowerMockTestNotifier
-
notifyAfterTestSuiteEnded
public void notifyAfterTestSuiteEnded(Class<?> testClass, Method[] methods, TestSuiteResult testResult) Notifies all listeners with the "after test suite ended" event.- Specified by:
notifyAfterTestSuiteEndedin interfacePowerMockTestNotifier
-
notifyBeforeTestMethod
Notifies all listeners with the "before test method started" event.- Specified by:
notifyBeforeTestMethodin interfacePowerMockTestNotifier
-
notifyBeforeTestSuiteStarted
Notifies all listeners with the "before test suite started" event.- Specified by:
notifyBeforeTestSuiteStartedin interfacePowerMockTestNotifier
-
notifyAfterTestMethod
public void notifyAfterTestMethod(boolean successful) Notifies 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.
-