Package org.junit.runner.notification

Examples of org.junit.runner.notification.RunListener


  @Test
  public void listenersAreCalledCorrectlyInTheFaceOfFailures()
      throws Exception {
    JUnitCore core= new JUnitCore();
    final List<Failure> failures= new ArrayList<Failure>();
    core.addListener(new RunListener() {
      @Override
      public void testRunFinished(Result result) throws Exception {
        failures.addAll(result.getFailures());
      }
    });
View Full Code Here


    }
  }
 
  @Test public void testListener() throws Exception {
    JUnitCore runner= new JUnitCore();
    RunListener listener= new RunListener() {
      @Override
      public void testStarted(Description description) {
        assertEquals(Description.createTestDescription(OneTest.class, "testOne"),
            description);
        count++;
View Full Code Here

public class OldTestClassAdaptingListenerTest {
  @Test
  public void addFailureDelegatesToNotifier() {
    Result result= new Result();
    RunListener listener= result.createListener();
    RunNotifier notifier= new RunNotifier();
    notifier.addFirstListener(listener);
    TestCase testCase= new TestCase() {
    };
    TestListener adaptingListener= new JUnit38ClassRunner(testCase)
View Full Code Here

  }
 
  @Test public void testFinished() {
    JUnitCore runner= new JUnitCore();
    wasRun= false;
    RunListener listener= new MyListener() {
      @Override
      public void testFinished(Description description) {
        wasRun= true;
      }
    };
View Full Code Here

    }
  }
  @Test public void notifyListenersInTheOrderInWhichTheyAreAdded() {
    JUnitCore core= new JUnitCore();
    log= "";
    core.addListener(new RunListener() {
      @Override
      public void testRunStarted(Description description) throws Exception {
        log+="first ";
      }
    });
    core.addListener(new RunListener() {
      @Override
      public void testRunStarted(Description description) throws Exception {
        log+="second ";
      }
    });
View Full Code Here

        sdb.test.Env.set(jdbc, params, false) ;
       
        JUnitCore x = new org.junit.runner.JUnitCore() ;
        //RunListener listener = new TextListener2() ;
        RunListener listener = new TextListener2(System.out) ;
        x.addListener(listener) ;
       
        //x.run(sdb.test.AllTests.class) ;
        System.out.println("String basic") ;
        x.run(TestStringBasic.class) ;
View Full Code Here

    this.failures= failures;
  }

  public Result result() {
    Result result= new Result();
    RunListener listener= result.createListener();
    for (Failure failure : failures) {
      try {
        listener.testFailure(failure);
      } catch (Exception e) {
        throw new RuntimeException("I can't believe this happened");
      }
    }
    return result;
View Full Code Here

        system.out().println("Could not find class: " + each);
        Description description= Description.createSuiteDescription(each);
        Failure failure= new Failure(description, e);
        missingClasses.add(failure);
      }
    RunListener listener= new TextListener(system);
    addListener(listener);
    Result result= run(classes.toArray(new Class[0]));
    for (Failure each : missingClasses)
      result.getFailures().add(each);
    return result;
View Full Code Here

  /**
   * Do not use. Testing purposes only.
   */
  public Result run(Runner runner) {
    Result result= new Result();
    RunListener listener= result.createListener();
    addFirstListener(listener);
    try {
      fNotifier.fireTestRunStarted(runner.getDescription());
      runner.run(fNotifier);
      fNotifier.fireTestRunFinished(result);
View Full Code Here

      super(clazz, findClasses());
    }
    @Override
    public void run(final RunNotifier notifier) {
      notifier.addListener(new RunListener() {
        @Override
        public void testFailure(Failure failure) throws Exception {
          // TODO get logger and log it
        }
View Full Code Here

TOP

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

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.