use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class AnnotationTest method testRunAllAfterClasses.
public void testRunAllAfterClasses() {
log = "";
JUnitCore core = new JUnitCore();
core.run(RunAllAfterClasses.class);
assertTrue(log.contains("one"));
assertTrue(log.contains("two"));
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class AnnotationTest method testRunFailure.
public void testRunFailure() throws Exception {
JUnitCore runner = new JUnitCore();
Result result = runner.run(FailureTest.class);
assertEquals(1, result.getRunCount());
assertEquals(1, result.getFailureCount());
assertEquals(AssertionError.class, result.getFailures().get(0).getException().getClass());
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class AnnotationTest method testTestInheritance.
public void testTestInheritance() throws Exception {
log = "";
JUnitCore core = new JUnitCore();
core.run(SubTest.class);
// The order in which the test methods are called is unspecified
assertTrue(log.contains("Sub"));
assertTrue(log.contains("Two"));
assertFalse(log.contains("Super"));
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class AssumptionTest method runAndGetAssumptionFailures.
/**
* Helper method that runs tests on <code>clazz</code> and returns any
* {@link Failure} objects that were {@link AssumptionViolatedException}s.
*/
private static List<Failure> runAndGetAssumptionFailures(Class<?> clazz) {
final List<Failure> failures = new ArrayList<Failure>();
final JUnitCore core = new JUnitCore();
core.addListener(new RunListener() {
@Override
public void testAssumptionFailure(Failure failure) {
failures.add(failure);
}
});
core.run(clazz);
return failures;
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class MaxStarterTest method correctErrorFromMalformedTest.
@Test
public void correctErrorFromMalformedTest() {
Request request = Request.aClass(MalformedJUnit38TestMethod.class);
JUnitCore core = new JUnitCore();
Request sorted = fMax.sortRequest(request);
Runner runner = sorted.getRunner();
Result result = core.run(runner);
Failure failure = result.getFailures().get(0);
assertThat(failure.toString(), containsString("MalformedJUnit38TestMethod"));
assertThat(failure.toString(), containsString("testNothing"));
assertThat(failure.toString(), containsString("isn't public"));
}
Aggregations