use of org.junit.runner.Request in project junit4 by junit-team.
the class MaxStarterTest method maxShouldSkipMalformedJUnit38Classes.
@Test
public void maxShouldSkipMalformedJUnit38Classes() {
Request request = Request.aClass(MalformedJUnit38Test.class);
fMax.run(request);
}
use of org.junit.runner.Request in project junit4 by junit-team.
the class MaxStarterTest method assertFilterLeavesTestUnscathed.
private void assertFilterLeavesTestUnscathed(Class<?> testClass) {
Request oneClass = Request.aClass(testClass);
Request filtered = oneClass.filterWith(new Filter() {
@Override
public boolean shouldRun(Description description) {
return true;
}
@Override
public String describe() {
return "Everything";
}
});
int filterCount = filtered.getRunner().testCount();
int coreCount = oneClass.getRunner().testCount();
assertEquals("Counts match up in " + testClass, coreCount, filterCount);
}
use of org.junit.runner.Request in project junit4 by junit-team.
the class MaxStarterTest method preferNewTests.
@Test
public void preferNewTests() {
Request one = Request.method(TwoTests.class, "succeed");
fMax.run(one);
Request two = Request.aClass(TwoTests.class);
List<Description> things = fMax.sortedLeavesForTest(two);
Description dontSucceed = Description.createTestDescription(TwoTests.class, "dontSucceed");
assertEquals(dontSucceed, things.get(0));
assertEquals(2, things.size());
}
use of org.junit.runner.Request in project junit4 by junit-team.
the class MaxStarterTest method twoTestsNotRunComeBackInRandomOrder.
@Test
public void twoTestsNotRunComeBackInRandomOrder() {
Request request = Request.aClass(TwoTests.class);
List<Description> things = fMax.sortedLeavesForTest(request);
Description succeed = Description.createTestDescription(TwoTests.class, "succeed");
Description dontSucceed = Description.createTestDescription(TwoTests.class, "dontSucceed");
assertTrue(things.contains(succeed));
assertTrue(things.contains(dontSucceed));
assertEquals(2, things.size());
}
use of org.junit.runner.Request in project junit4 by junit-team.
the class MaxStarterTest method preferNewTestsOverTestsThatFailed.
// This covers a seemingly-unlikely case, where you had a test that failed
// on the
// last run and you also introduced new tests. In such a case it pretty much
// doesn't matter
// which order they run, you just want them both to be early in the sequence
@Test
public void preferNewTestsOverTestsThatFailed() {
Request one = Request.method(TwoTests.class, "dontSucceed");
fMax.run(one);
Request two = Request.aClass(TwoTests.class);
List<Description> things = fMax.sortedLeavesForTest(two);
Description succeed = Description.createTestDescription(TwoTests.class, "succeed");
assertEquals(succeed, things.get(0));
assertEquals(2, things.size());
}
Aggregations