Package org.junit.runners

Examples of org.junit.runners.BlockJUnit4ClassRunner


    }
  }
 
  public static Runner create(Class<?> clazz) throws InitializationError, org.junit.internal.runners.InitializationError {
    if (jUnit45OrHigher) {
      return new BlockJUnit4ClassRunner(clazz) {
                protected Statement withBefores(FrameworkMethod method, Object target, Statement statement) {
                  initMocks(target);
                  return super.withBefores(method, target, statement);
              }
          };
View Full Code Here


  }

  @Test
  public void useChildHarvester() throws InitializationError {
    log= "";
    ParentRunner<?> runner= new BlockJUnit4ClassRunner(FruitTest.class);
    runner.setScheduler(new RunnerScheduler() {
      public void schedule(Runnable childStatement) {
        log+= "before ";
        childStatement.run();
        log+= "after ";
      }

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

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

        { SubShadows.class, 0 } });
  }
 
  private List<Throwable> validateAllMethods(Class<?> clazz) {
    try {
      new BlockJUnit4ClassRunner(clazz);
    } catch (InitializationError e) {
      return e.getCauses();
    }
    return Collections.emptyList();
  }
View Full Code Here

  }

  @Test
  public void detectNonStaticEnclosedClass() throws Exception {
    try {
      new BlockJUnit4ClassRunner(OuterClass.Enclosed.class);
    } catch (InitializationError e) {
      List<Throwable> causes= e.getCauses();
      assertEquals("Wrong number of causes.", 1, causes.size());
      assertEquals(
          "Wrong exception.",
View Full Code Here

import org.junit.tests.validation.anotherpackage.Sub;

public class InaccessibleBaseClassTest {
  @Test(expected= InitializationError.class)
  public void inaccessibleBaseClassIsCaughtAtValidation() throws InitializationError {
    new BlockJUnit4ClassRunner(Sub.class);
  }
View Full Code Here

  @Test
  public void categoryFilterLeavesOnlyMatchingMethods()
      throws InitializationError, NoTestsRemainException {
    CategoryFilter filter= CategoryFilter.include(SlowTests.class);
    BlockJUnit4ClassRunner runner= new BlockJUnit4ClassRunner(A.class);
    filter.apply(runner);
    assertEquals(1, runner.testCount());
  }
View Full Code Here

  @Test
  public void categoryFilterRejectsIncompatibleCategory()
      throws InitializationError, NoTestsRemainException {
    CategoryFilter filter= CategoryFilter.include(SlowTests.class);
    BlockJUnit4ClassRunner runner= new BlockJUnit4ClassRunner(
        OneFastOneSlow.class);
    filter.apply(runner);
    assertEquals(1, runner.testCount());
  }
View Full Code Here

    assertTrue(problems.isEmpty());
  }

  private List<Throwable> validateAllMethods(Class<?> clazz) {
    try {
      new BlockJUnit4ClassRunner(clazz);
    } catch (InitializationError e) {
      return e.getCauses();
    }
    return Collections.emptyList();
  }
View Full Code Here

    @Test public void a() {
    }
  }
 
  @Test(expected=InitializationError.class) public void overloaded() throws InitializationError {
    new BlockJUnit4ClassRunner(Confused.class);
  }
View Full Code Here

    @Test public void a() {
    }
  }
 
  @Test(expected=InitializationError.class) public void constructorParameter() throws InitializationError {
    new BlockJUnit4ClassRunner(ConstructorParameter.class);
  }
View Full Code Here

TOP

Related Classes of org.junit.runners.BlockJUnit4ClassRunner

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.