Examples of PowerMockTestNotifierImpl


Examples of org.powermock.tests.utils.impl.PowerMockTestNotifierImpl

  private final PowerMockTestNotifier powerMockTestNotifier;

  @SuppressWarnings("unchecked")
  public PowerMockJUnit4LegacyTestClassMethodsRunner(Class<?> klass, PowerMockTestListener[] powerMockTestListeners) {
    super(klass);
    this.powerMockTestNotifier = new PowerMockTestNotifierImpl(powerMockTestListeners);
    List<Method> testMethods = (List<Method>) Whitebox.getInternalState(this, "fTestMethods", TestClassMethodsRunner.class);
    testMethods.addAll(getAdditionalTestMethods(klass));
  }
View Full Code Here

Examples of org.powermock.tests.utils.impl.PowerMockTestNotifierImpl

    for (TestChunk testChunk : getTestChunks()) {
      allMethods.addAll(testChunk.getTestMethodsToBeExecutedByThisClassloader());
    }

    final Method[] allMethodsAsArray = allMethods.toArray(new Method[0]);
    final PowerMockTestNotifier powerMockTestNotifier = new PowerMockTestNotifierImpl(powerMockTestListeners);
    powerMockTestNotifier.notifyBeforeTestSuiteStarted(testClass, allMethodsAsArray);

    int failureCount = 0;
    int successCount = 0;
    int ignoreCount = 0;

        for (PowerMockJUnitRunnerDelegate delegate : delegates) {
            TestChunk next = iterator.next();
            final ClassLoader key = next.getClassLoader();
            PowerMockJUnit4RunListener powerMockListener = new PowerMockJUnit4RunListener(key, powerMockTestNotifier);
            notifier.addListener(powerMockListener);
            final ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
            Thread.currentThread().setContextClassLoader(key);
            try {
                delegate.run(notifier);
            } finally {
                Thread.currentThread().setContextClassLoader(originalClassLoader);
            }
            final int failureCountForThisPowerMockListener = powerMockListener.getFailureCount();
            final int ignoreCountForThisPowerMockListener = powerMockListener.getIgnoreCount();
            failureCount += failureCountForThisPowerMockListener;
            ignoreCount += ignoreCountForThisPowerMockListener;
            successCount += delegate.getTestCount() - failureCountForThisPowerMockListener
                    - ignoreCountForThisPowerMockListener;
            notifier.removeListener(powerMockListener);
        }

    final TestSuiteResult testSuiteResult = new TestSuiteResultImpl(failureCount, successCount, getTestCount(),
        ignoreCount);
    powerMockTestNotifier.notifyAfterTestSuiteEnded(testClass, allMethodsAsArray, testSuiteResult);
  }
View Full Code Here

Examples of org.powermock.tests.utils.impl.PowerMockTestNotifierImpl

    private final List<Method> testMethods;
    private final TestClass testClass;
    private final PowerMockTestNotifier powerMockTestNotifier;

    public PowerMockJUnit44RunnerDelegateImpl(Class<?> klass, String[] methodsToRun, PowerMockTestListener[] listeners) throws InitializationError {
        this.powerMockTestNotifier = new PowerMockTestNotifierImpl(listeners == null ? new PowerMockTestListener[0] : listeners);
        testClass = new TestClass(klass);
        testMethods = getTestMethods(klass, methodsToRun);
        validate();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.