Search in sources :

Example 1 with RunnerScheduler

use of org.junit.runners.model.RunnerScheduler in project junit4 by junit-team.

the class ParentRunnerTest method useChildHarvester.

@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);
}
Also used : RunNotifier(org.junit.runner.notification.RunNotifier) BlockJUnit4ClassRunner(org.junit.runners.BlockJUnit4ClassRunner) RunnerScheduler(org.junit.runners.model.RunnerScheduler) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 RunNotifier (org.junit.runner.notification.RunNotifier)1 BlockJUnit4ClassRunner (org.junit.runners.BlockJUnit4ClassRunner)1 RunnerScheduler (org.junit.runners.model.RunnerScheduler)1