Package org.junit.runner.notification

Examples of org.junit.runner.notification.RunNotifier


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


    }
  }

  public RunNotifier getNotifier(final TestResult result,
      final JUnit4TestAdapter adapter) {
    RunNotifier notifier = new RunNotifier();
    notifier.addListener(new RunListener() {
      @Override
      public void testFailure(Failure failure) throws Exception {
        result.addError(asTest(failure.getDescription()), failure.getException());
      }
View Full Code Here

    public RunNotifier getNotifier(final TestResult result) {

        final IgnoredTestResult resultWrapper = (IgnoredTestResult) result;

        RunNotifier notifier = new RunNotifier();
        notifier.addListener(new RunListener() {
            @Override
            public void testFailure(Failure failure) throws Exception {
                result.addError(asTest(failure.getDescription()), failure.getException());
            }
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

        ConsoleOutputCapture.startCapture( (ConsoleOutputReceiver) reporter );

        JUnit4RunListener jUnit4TestSetReporter = new JUnit4RunListener( reporter );

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

        runNotifer.fireTestRunStarted( null );

        for ( Class<?> clazz : testsToRun.getLocatedClasses() )
        {
            executeTestSet( clazz, 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

  }

  @Test
  public void runTestAndAssertCounters() throws Exception {
    final FailureTrackingRunListener failureTrackingRunListener = new FailureTrackingRunListener();
    final RunNotifier notifier = new RunNotifier();
    notifier.addListener(failureTrackingRunListener);

    new SpringJUnit4ClassRunner(this.clazz).run(notifier);
    assertEquals("Verifying number of failures for test class [" + this.clazz + "].", 1,
        failureTrackingRunListener.failureCount);
  }
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

    try {
      Class c = Class.forName(target.substring(1), true, getClass().getClassLoader());
      HegemonRunner runner =
          new HegemonRunner(c, baseRequest.getQueryString(), this.loadPath);
      RunNotifier notifier = new RunNotifier();
      notifier.addListener(new ResponseListener(response));

      long start = System.currentTimeMillis();

      response.setContentType("text/html;charset=utf-8");
      response.getWriter().print(
View Full Code Here

TOP

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

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.