use of org.junit.runner.Request in project junit4 by junit-team.
the class ParentRunnerTest method assertClassHasFailureMessage.
private void assertClassHasFailureMessage(Class<?> klass, String message) {
JUnitCore junitCore = new JUnitCore();
Request request = Request.aClass(klass);
Result result = junitCore.run(request);
assertThat(result.getFailureCount(), is(1));
assertThat(result.getFailures().get(0).getMessage(), containsString(message));
}
use of org.junit.runner.Request in project junit4 by junit-team.
the class ParentRunnerFilteringTest method testRunSuiteFiltering.
@Test
public void testRunSuiteFiltering() throws Exception {
Request request = Request.aClass(ExampleSuite.class);
Request requestFiltered = request.filterWith(notThisMethodName("test1"));
assertThat(testResult(requestFiltered), hasSingleFailureContaining("don't run method name: test1"));
}
use of org.junit.runner.Request in project junit4 by junit-team.
the class ParentRunnerFilteringTest method testCountClassFiltering.
@Test
public void testCountClassFiltering() throws Exception {
JUnitCore junitCore = new JUnitCore();
Request request = Request.aClass(ExampleTest.class);
CountingFilter countingFilter = new CountingFilter();
Request requestFiltered = request.filterWith(countingFilter);
Result result = junitCore.run(requestFiltered);
assertEquals(1, result.getRunCount());
assertEquals(0, result.getFailureCount());
Description desc = createTestDescription(ExampleTest.class, "test1");
assertEquals(1, countingFilter.getCount(desc));
}
use of org.junit.runner.Request in project junit4 by junit-team.
the class JUnit38SortingTest method preferRecentlyFailed38Test.
@Test
public void preferRecentlyFailed38Test() {
Request request = Request.classes(JUnit4Test.class, JUnit38Test.class);
fMax.run(request);
List<Description> tests = fMax.sortedLeavesForTest(request);
Description dontSucceed = Description.createTestDescription(JUnit38Test.class, "testFails");
assertEquals(dontSucceed, tests.get(0));
}
use of org.junit.runner.Request 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