/** {@inheritDoc} */ public void notifyBeforeTestSuiteStarted(Class<?> testClass, Method[] testMethods) { for (PowerMockTestListener powerMockTestListener : powerMockTestListeners) { try { powerMockTestListener.beforeTestSuiteStarted(testClass, testMethods); } catch (Exception e) { throw new RuntimeException( String.format(ERROR_MESSAGE_TEMPLATE, "beforeTestSuiteStarted", powerMockTestListener), e); } } }
/** {@inheritDoc} */ public void notifyAfterTestSuiteEnded( Class<?> testClass, Method[] methods, TestSuiteResult testResult) { for (PowerMockTestListener powerMockTestListener : powerMockTestListeners) { try { powerMockTestListener.afterTestSuiteEnded(testClass, methods, testResult); } catch (Exception e) { throw new RuntimeException( String.format(ERROR_MESSAGE_TEMPLATE, "afterTestSuiteEnded", powerMockTestListener), e); } } }
/** {@inheritDoc} */ public void notifyAfterTestMethod( Object testInstance, Method method, Object[] arguments, TestMethodResult testResult) { for (int i = 0; i < powerMockTestListeners.length; i++) { final PowerMockTestListener testListener = powerMockTestListeners[i]; try { testListener.afterTestMethod(testInstance, method, arguments, testResult); } catch (Exception e) { throw new RuntimeException( String.format(ERROR_MESSAGE_TEMPLATE, "afterTestMethod", testListener), e); } } }
/** {@inheritDoc} */ public void notifyBeforeTestMethod(Object testInstance, Method testMethod, Object[] arguments) { MockRepository.putAdditionalState(Keys.CURRENT_TEST_INSTANCE, testInstance); MockRepository.putAdditionalState(Keys.CURRENT_TEST_METHOD, testMethod); MockRepository.putAdditionalState(Keys.CURRENT_TEST_METHOD_ARGUMENTS, arguments); for (int i = 0; i < powerMockTestListeners.length; i++) { final PowerMockTestListener testListener = powerMockTestListeners[i]; try { testListener.beforeTestMethod(testInstance, testMethod, arguments); } catch (Exception e) { throw new RuntimeException( String.format(ERROR_MESSAGE_TEMPLATE, "beforeTestMethod", testListener), e); } } }