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


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 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

    @Test
    public void failedAssumptionsCanBeDetectedByListeners() {
        assumptionFailures = 0;
        JUnitCore core = new JUnitCore();
        core.addListener(new RunListener() {
            @Override
            public void testAssumptionFailure(Failure failure) {
                assumptionFailures++;
            }
        });
View Full Code Here

     * {@link Failure} objects that were {@link AssumptionViolatedException}s.
     */
    private static List<Failure> runAndGetAssumptionFailures(Class<?> clazz) {
        final List<Failure> failures = new ArrayList<Failure>();
        final JUnitCore core = new JUnitCore();
        core.addListener(new RunListener() {
            @Override
            public void testAssumptionFailure(Failure failure) {
                failures.add(failure);
            }
        });
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

    }
  }
  @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

    }
  }
 
  @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

  }
 
  @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

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.