Package org.junit.runner.notification

Examples of org.junit.runner.notification.RunNotifier$SafeNotifier


    Assert.assertEquals(junit.getRunCount(), rrunner.getRunCount());
  }

  private Result runRequest(Request request) {
    Result result = new Result();
    RunNotifier notifier = new RunNotifier();
    RunListener listener = result.createListener();
    notifier.addFirstListener(listener);
    try {
      Runner runner = request.getRunner();
      notifier.fireTestRunStarted(runner.getDescription());
      runner.run(notifier);
      notifier.fireTestRunFinished(result);
    } finally {
      notifier.removeListener(listener);
    }
    return result;
  }
View Full Code Here


  /**
   * Create a new <code>JUnitCore</code> to run tests.
   */
  public JUnitCore() {
    fNotifier= new RunNotifier();
  }
View Full Code Here

  @Test
  public void testThreadInitialization() throws Throwable {
    GrinderRunner runner = new GrinderRunner(TestSample.class);
    LOGGER.debug("start the test function...");
    runner.run(new RunNotifier() {
      @Override
      public void fireTestFailure(Failure failure) {
        throw new RuntimeException(failure.getException());
      }
    });
View Full Code Here

  public static JUnit4TestAdapterCache getDefault() {
            return instance;
  }
 
  public RunNotifier getNotifier(final TestResult result) {
            RunNotifier notifier = new RunNotifier();
            notifier.addListener(new RunListener() {
                    public void testFailure(Failure failure) throws Exception {
                        result.addError(asTest(failure.getDescription()),
                                        failure.getException());
                    }
View Full Code Here

  /**
   * Create a new <code>JUnitCore</code> to run tests.
   */
  public JUnitCore() {
    fNotifier= new RunNotifier();
  }
View Full Code Here

        ConsoleOutputCapture.startCapture( (ConsoleOutputReceiver) reporter );

        JUnit4RunListener jUnit4TestSetReporter = new JUnit4RunListener( reporter );

        Result result = new Result();
        RunNotifier runNotifer = getRunNotifer( jUnit4TestSetReporter, result, customRunListeners );

        runNotifer.fireTestRunStarted( null );

        for ( @SuppressWarnings( "unchecked" ) Iterator<Class<?>> iter = testsToRun.iterator(); iter.hasNext(); )
        {
            executeTestSet( iter.next(), reporter, runNotifer );
        }

        runNotifer.fireTestRunFinished( result );

        JUnit4RunListener.rethrowAnyTestMechanismFailures( result );

        closeRunNotifer( jUnit4TestSetReporter, customRunListeners );
View Full Code Here

    }

    private RunNotifier getRunNotifer( org.junit.runner.notification.RunListener main, Result result,
                                       List<org.junit.runner.notification.RunListener> others )
    {
        RunNotifier fNotifier = new RunNotifier();
        fNotifier.addListener( main );
        fNotifier.addListener( result.createListener() );
        for ( org.junit.runner.notification.RunListener listener : others )
        {
            fNotifier.addListener( listener );
        }
        return fNotifier;
    }
View Full Code Here

    // I am not entierly sure as to why we do this explicit freeing, it's one of those
    // pieces of code that just seem to linger on in here ;)
    private void closeRunNotifer( org.junit.runner.notification.RunListener main,
                                  List<org.junit.runner.notification.RunListener> others )
    {
        RunNotifier fNotifier = new RunNotifier();
        fNotifier.removeListener( main );
        for ( org.junit.runner.notification.RunListener listener : others )
        {
            fNotifier.removeListener( listener );
        }
    }
View Full Code Here

    unsubscribeListeners(notifier);
    context.popAndDestroy();   
  }

  private boolean areAllRemainingIgnored(List<TestCandidate> filtered) {
    RunNotifier fake = new RunNotifier();
    for (TestCandidate candidate : filtered) {
      if (!isTestIgnored(fake, candidate)) {
        return false;
      }
    }
View Full Code Here

   * @return The test result.
   */
  protected Result runTest(Runner runner) {
    Result result = new Result();

    RunNotifier notifier = new RunNotifier();
    notifier.addFirstListener(result.createListener());

    notifier.fireTestRunStarted(runner.getDescription());
    runner.run(notifier);
    notifier.fireTestRunFinished(result);

    return result;
  }
View Full Code Here

TOP

Related Classes of org.junit.runner.notification.RunNotifier$SafeNotifier

Copyright © 2018 www.massapicom. 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.