use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class JUnit38ClassRunnerTest method testListener.
@Test
public void testListener() throws Exception {
JUnitCore runner = new JUnitCore();
RunListener listener = new RunListener() {
@Override
public void testStarted(Description description) {
assertEquals(Description.createTestDescription(OneTest.class, "testOne"), description);
count++;
}
};
runner.addListener(listener);
count = 0;
Result result = runner.run(OneTest.class);
assertEquals(1, count);
assertEquals(1, result.getRunCount());
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class SingleMethodTest method parameterizedFilterToSingleMethod.
@Test
public void parameterizedFilterToSingleMethod() throws Exception {
count = 0;
Runner runner = Request.method(ParameterizedOneTimeSetup.class, "one[0]").getRunner();
Result result = new JUnitCore().run(runner);
assertEquals(1, result.getRunCount());
}
use of org.junit.runner.JUnitCore 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());
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class ClassLevelMethodsWithIgnoredTestsTest method beforeClassShouldNotRunWhenAllTestsAreFiltered.
@Test
public void beforeClassShouldNotRunWhenAllTestsAreFiltered() {
Result result = new JUnitCore().run(Request.classes(BeforeClassWithFilteredTest.class, HasUnfilteredTest.class).filterWith(CategoryFilter.exclude(FilteredTests.class)));
analyseResult(result, "BeforeClass should not have been executed because the test method is filtered!");
}
use of org.junit.runner.JUnitCore in project junit4 by junit-team.
the class AnnotationTest method testOldTest.
public void testOldTest() throws Exception {
JUnitCore runner = new JUnitCore();
runner.run(OldTest.class);
assertTrue(run);
}
Aggregations