use of org.junit.runners.BlockJUnit4ClassRunner in project junit4 by junit-team.
the class ParentRunnerClassLoaderTest method testBackwardCompatibilityWithOverrideGetName.
@Test
public void testBackwardCompatibilityWithOverrideGetName() throws Exception {
final Class<TestWithClassRule> originalTestClass = TestWithClassRule.class;
final Class<?> waitClass = ParentRunnerClassLoaderTest.class;
ParentRunner<FrameworkMethod> subParentRunner = new BlockJUnit4ClassRunner(originalTestClass) {
@Override
protected String getName() {
return waitClass.getName();
}
};
Description description = subParentRunner.getDescription();
Class<?> result = description.getTestClass();
assertEquals("Subclass of ParentRunner can override getName method and specify another test class for run, " + "we should maintain backwards compatibility with JUnit 4.12", waitClass, result);
}
use of org.junit.runners.BlockJUnit4ClassRunner in project junit4 by junit-team.
the class ParentRunnerClassLoaderTest method runTestWithParentRunner.
private void runTestWithParentRunner(Class<?> testClass) throws InitializationError {
ParentRunner<?> runner = new BlockJUnit4ClassRunner(testClass);
runner.run(new RunNotifier());
}
use of org.junit.runners.BlockJUnit4ClassRunner 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);
}
use of org.junit.runners.BlockJUnit4ClassRunner in project vert.x by eclipse.
the class AsyncTestBaseTest method testReportLateFailures.
@Test
public void testReportLateFailures() {
Result result;
try {
result = new JUnitCore().run(new BlockJUnit4ClassRunner(LateFailureReport.class));
} catch (InitializationError initializationError) {
throw new AssertionError(initializationError);
}
assertEquals(1, result.getFailureCount());
assertEquals(IllegalStateException.class, result.getFailures().get(0).getException().getClass());
}
Aggregations