Package org.junit.runner.notification

Examples of org.junit.runner.notification.RunListener


        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();
    fNotifier.addFirstListener(listener);
    try {
      fNotifier.fireTestRunStarted(runner.getDescription());
      runner.run(fNotifier);
      fNotifier.fireTestRunFinished(result);
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

    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

    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

    extends TestCase
{
    public void testTestRunStarted()
        throws Exception
    {
        RunListener jUnit4TestSetReporter =
            new JUnitCoreRunListener( new MockReporter(), new HashMap<String, TestSet>() );
        JUnitCore core = new JUnitCore();
        core.addListener( jUnit4TestSetReporter );
        Result result = core.run( new Computer(), STest1.class, STest2.class );
        core.removeListener( jUnit4TestSetReporter );
View Full Code Here

    }

    public void testFailedAssumption()
        throws Exception
    {
        RunListener jUnit4TestSetReporter =
            new JUnitCoreRunListener( new MockReporter(), new HashMap<String, TestSet>() );
        JUnitCore core = new JUnitCore();
        core.addListener( jUnit4TestSetReporter );
        Result result = core.run( new Computer(), TestWithAssumptionFailure.class );
        core.removeListener( jUnit4TestSetReporter );
View Full Code Here

   
    @Override
    public void run(RunNotifier notifier) {       

        //a listener that changes the failure's exception in a very hacky way...
        RunListener listener = new RunListener() {
           
            WarningsCollector warningsCollector;
                      
            @Override
            public void testStarted(Description description) throws Exception {
View Full Code Here

   
    // only print iteration info if the user requested more than one iterations
    final boolean verbose = VERBOSE && TEST_ITER > 1;
   
    final int currentIter[] = new int[1];
    arg1.addListener(new RunListener() {
      @Override
      public void testFailure(Failure failure) throws Exception {
        if (verbose) {
          System.out.println("\nNOTE: iteration " + currentIter[0] + " failed! ");
        }
View Full Code Here

   * Test execution logic for the entire suite, executing under designated
   * {@link RunnerThreadGroup}.
   */
  private void runSuite(final RandomizedContext context, final RunNotifier notifier) {
    final Result result = new Result();
    final RunListener accounting = result.createListener();
    notifier.addListener(accounting);

    final Randomness classRandomness = runnerRandomness.clone(Thread.currentThread());
    context.push(classRandomness);
    try {
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.