org.powermock.tests.utils.impl
Class PowerMockTestNotifierImpl

java.lang.Object
  extended by org.powermock.tests.utils.impl.PowerMockTestNotifierImpl
All Implemented Interfaces:
PowerMockTestNotifier

public class PowerMockTestNotifierImpl
extends Object
implements PowerMockTestNotifier

Utility class that may be used by PowerMock test runners to notify listeners. Uses the MockRepository to set and get state.


Constructor Summary
PowerMockTestNotifierImpl(PowerMockTestListener[] powerMockTestListeners)
          Create a new instance with the following parameters.
 
Method Summary
 void notifyAfterTestMethod(boolean successful)
          Notifies all listeners with the "after test method ended" event.
 void notifyAfterTestMethod(Object testInstance, Method method, Object[] arguments, TestMethodResult testResult)
          Notifies all listeners with the "after test method ended" event.
 void notifyAfterTestSuiteEnded(Class<?> testClass, Method[] methods, TestSuiteResult testResult)
          Notifies all listeners with the "after test suite ended" event.
 void notifyBeforeTestMethod(Object testInstance, Method testMethod, Object[] arguments)
          Notifies all listeners with the "before test method started" event.
 void notifyBeforeTestSuiteStarted(Class<?> testClass, Method[] testMethods)
          Notifies all listeners with the "before test suite started" event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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(Object testInstance,
                                  Method method,
                                  Object[] arguments,
                                  TestMethodResult testResult)
Notifies all listeners with the "after test method ended" event.

Specified by:
notifyAfterTestMethod in interface PowerMockTestNotifier

notifyAfterTestSuiteEnded

public void notifyAfterTestSuiteEnded(Class<?> testClass,
                                      Method[] methods,
                                      TestSuiteResult testResult)
Notifies all listeners with the "after test suite ended" event.

Specified by:
notifyAfterTestSuiteEnded in interface PowerMockTestNotifier

notifyBeforeTestMethod

public void notifyBeforeTestMethod(Object testInstance,
                                   Method testMethod,
                                   Object[] arguments)
Notifies all listeners with the "before test method started" event.

Specified by:
notifyBeforeTestMethod in interface PowerMockTestNotifier

notifyBeforeTestSuiteStarted

public void notifyBeforeTestSuiteStarted(Class<?> testClass,
                                         Method[] testMethods)
Notifies all listeners with the "before test suite started" event.

Specified by:
notifyBeforeTestSuiteStarted in interface PowerMockTestNotifier

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 work PowerMockTestNotifier.notifyBeforeTestMethod(Object, Method, Object[]) must have been called before this method. Otherwise revert to using the PowerMockTestNotifier.notifyAfterTestMethod(Object, Method, Object[], TestMethodResult) method.

Specified by:
notifyAfterTestMethod in interface PowerMockTestNotifier
Parameters:
successful - true if the test was successful, false otherwise.


Copyright © 2007-2013. All Rights Reserved.