private void runInvokedMethodListeners(InvokedMethodListenerMethod listenerMethod, IInvokedMethod invokedMethod, ITestResult testResult) { if (noListenersPresent()) { return; } InvokedMethodListenerInvoker invoker = new InvokedMethodListenerInvoker(listenerMethod, testResult, m_testContext); for (IInvokedMethodListener currentListener : m_invokedMethodListeners) { invoker.invokeListener(currentListener, invokedMethod); } }
/** * Invoke the given {@code listenerInstance}, calling the method specified in the constructor of * this {@link InvokedMethodListenerInvoker}. * * @param listenerInstance the listener instance which should be invoked. * @param invokedMethod the {@link IInvokedMethod} instance which should be passed to the * {@link IInvokedMethodListener#beforeInvocation(IInvokedMethod, ITestResult)}, * {@link IInvokedMethodListener#afterInvocation(IInvokedMethod, ITestResult)}, * {@link IInvokedMethodListener2#beforeInvocation(IInvokedMethod, ITestResult, ITestContext)} * or {@link IInvokedMethodListener2#afterInvocation(IInvokedMethod, ITestResult, ITestContext)} * method. */ @SuppressWarnings("unchecked") public void invokeListener(IInvokedMethodListener listenerInstance, IInvokedMethod invokedMethod) { final InvocationStrategy strategy = obtainStrategyFor(listenerInstance, m_listenerMethod); strategy.callMethod(listenerInstance, invokedMethod, m_testResult, m_testContext); }
/** * Invoke the given {@code listenerInstance}, calling the method specified in the constructor of * this {@link InvokedMethodListenerInvoker}. * * @param listenerInstance the listener instance which should be invoked. * @param invokedMethod the {@link IInvokedMethod} instance which should be passed to the {@link * IInvokedMethodListener#beforeInvocation(IInvokedMethod, ITestResult)}, {@link * IInvokedMethodListener#afterInvocation(IInvokedMethod, ITestResult)}, {@link * IInvokedMethodListener#beforeInvocation(IInvokedMethod, ITestResult, ITestContext)} or * {@link IInvokedMethodListener#afterInvocation(IInvokedMethod, ITestResult, ITestContext)} * method. */ @SuppressWarnings("unchecked") public void invokeListener( IInvokedMethodListener listenerInstance, IInvokedMethod invokedMethod) { final InvocationStrategy strategy = obtainStrategyFor(listenerInstance, m_listenerMethod); strategy.callMethod(listenerInstance, invokedMethod, m_testResult, m_testContext); }
protected void runInvokedMethodListeners( InvokedMethodListenerMethod listenerMethod, IInvokedMethod invokedMethod, ITestResult testResult) { if (noListenersPresent()) { return; } InvokedMethodListenerInvoker invoker = new InvokedMethodListenerInvoker(listenerMethod, testResult, m_testContext); for (IInvokedMethodListener currentListener : m_invokedMethodListeners) { invoker.invokeListener(currentListener, invokedMethod); } }