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"));
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class MaxStarterTest method correctErrorFromHalfMalformedTest.
@Test
public void correctErrorFromHalfMalformedTest() {
Request request = Request.aClass(HalfMalformedJUnit38TestMethod.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"));
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class MaxStarterTest method junit3TestsAreRunOnce.
@Test
public void junit3TestsAreRunOnce() throws Exception {
Result result = fMax.run(Request.aClass(TwoOldTests.class), new JUnitCore());
assertEquals(2, result.getRunCount());
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class StopwatchTest method runTest.
private static Result runTest(Class<?> test) {
simulateTimePassing(1L);
JUnitCore junitCore = new JUnitCore();
return junitCore.run(Request.aClass(test).getRunner());
}
Aggregations