Package org.junit.runner.notification

Examples of org.junit.runner.notification.RunNotifier


        if (e == null) throw new NoSuchMethodError("Method not found.");
        return (T) runExample(e);
    }

    private static Object runExample(Example e) {
        e.run(new RunNotifier());
        if (!e.wasSuccessful()) throw new RuntimeException("Test failed.");
        return e.returnValue.getValue();
    }
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)
                .createAdaptingListener(notifier);
        adaptingListener.addFailure(testCase, new AssertionFailedError());
View Full Code Here

            public void finished() {
                log += "afterAll ";
            }
        });

        runner.run(new RunNotifier());
        assertEquals("before apple after before banana after afterAll ", log);
    }
View Full Code Here

        Assert.assertEquals(1, countingRunListener.testIgnored);
    }

    private CountingRunListener runTestWithParentRunner(Class<?> testClass) throws InitializationError {
        CountingRunListener listener = new CountingRunListener();
        RunNotifier runNotifier = new RunNotifier();
        runNotifier.addListener(listener);
        ParentRunner runner = new BlockJUnit4ClassRunner(testClass);
        runner.run(runNotifier);
        return listener;
    }
View Full Code Here

public class UserStopTest {
    private RunNotifier fNotifier;

    @Before
    public void createNotifier() {
        fNotifier = new RunNotifier();
        fNotifier.pleaseStop();
    }
View Full Code Here

public class UserStopTest {
  private RunNotifier fNotifier;

  @Before public void createNotifier() {
    fNotifier= new RunNotifier();
    fNotifier.pleaseStop();   
  }
View Full Code Here

    public void testTestStarted()
        throws Exception
    {
        RunListener jUnit4TestSetReporter = new JUnit4RunListener( new MockReporter() );
        Runner junitTestRunner = Request.classes( "abc", STest1.class, STest2.class ).getRunner();
        RunNotifier runNotifier = new RunNotifier();
        runNotifier.addListener( jUnit4TestSetReporter );
        junitTestRunner.run( 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 ( Class aTestsToRun : testsToRun )
        {
            executeTestSet( aTestsToRun, 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

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.