use of org.junit.runner.Runner in project junit4 by junit-team.
the class FilterRequest method getRunner.
@Override
public Runner getRunner() {
try {
Runner runner = request.getRunner();
fFilter.apply(runner);
return runner;
} catch (NoTestsRemainException e) {
return new ErrorReportingRunner(Filter.class, new Exception(String.format("No tests found matching %s from %s", fFilter.describe(), request.toString())));
}
}
use of org.junit.runner.Runner in project junit4 by junit-team.
the class ParentRunnerFilteringTest method testSuiteFilteringWithUnmodifiableChildList.
@Test
public void testSuiteFilteringWithUnmodifiableChildList() throws Exception {
Runner runner = Request.aClass(ExampleSuiteWithUnmodifiableChildList.class).getRunner();
Filter filter = notThisMethodName("test1");
try {
filter.apply(runner);
} catch (NoTestsRemainException e) {
return;
}
fail("Expected 'NoTestsRemainException' due to complete filtering");
}
use of org.junit.runner.Runner in project junit4 by junit-team.
the class ParentRunnerFilteringTest method testSuiteFiltering.
@Test
public void testSuiteFiltering() throws Exception {
Runner runner = Request.aClass(ExampleSuite.class).getRunner();
Filter filter = notThisMethodName("test1");
try {
filter.apply(runner);
} catch (NoTestsRemainException e) {
return;
}
fail("Expected 'NoTestsRemainException' due to complete filtering");
}
use of org.junit.runner.Runner in project junit4 by junit-team.
the class ParameterizedTestTest method plansNamedCorrectly.
@Test
public void plansNamedCorrectly() throws Exception {
Runner runner = Request.aClass(AdditionTest.class).getRunner();
Description description = runner.getDescription();
assertEquals("[2: 3 + 2 = 5]", description.getChildren().get(2).getDisplayName());
}
use of org.junit.runner.Runner in project junit4 by junit-team.
the class SingleMethodTest method oneTimeSetup.
@Test
public void oneTimeSetup() throws Exception {
count = 0;
Runner runner = Request.method(OneTimeSetup.class, "one").getRunner();
Result result = new JUnitCore().run(runner);
assertEquals(1, count);
assertEquals(1, result.getRunCount());
}
Aggregations