use of org.junit.runner.Result in project junit4 by junit-team.
the class OldTestClassAdaptingListenerTest method addFailureDelegatesToNotifier.
@Test
public void addFailureDelegatesToNotifier() {
Result result = new Result();
RunListener listener = result.createListener();
RunNotifier notifier = new RunNotifier();
notifier.addFirstListener(listener);
TestCase testCase = new TestCase() {
};
TestListener adaptingListener = new JUnit38ClassRunner(testCase).createAdaptingListener(notifier);
adaptingListener.addFailure(testCase, new AssertionFailedError());
assertEquals(1, result.getFailureCount());
}
use of org.junit.runner.Result in project junit4 by junit-team.
the class SuiteMethodTest method suiteIsUsedWithJUnit4Classes.
@Test
public void suiteIsUsedWithJUnit4Classes() {
wasRun = false;
Result result = JUnitCore.runClasses(NewTestSuiteFails.class);
assertEquals(1, result.getFailureCount());
assertFalse(wasRun);
}
use of org.junit.runner.Result in project junit4 by junit-team.
the class SuiteMethodTest method makeSureSuiteNotUsedWithJUnit4Classes2.
@Test
public void makeSureSuiteNotUsedWithJUnit4Classes2() {
wasRun = false;
NewTestSuiteNotUsed.wasIgnoredRun = false;
Result res = JUnitCore.runClasses(NewTestSuiteNotUsed.class);
assertTrue(wasRun);
assertFalse(NewTestSuiteNotUsed.wasIgnoredRun);
assertEquals(0, res.getFailureCount());
assertEquals(1, res.getRunCount());
assertEquals(0, res.getIgnoreCount());
}
use of org.junit.runner.Result in project junit4 by junit-team.
the class JUnit38ClassRunnerTest method canUnadaptAnAdapter.
@Test
public void canUnadaptAnAdapter() {
JUnit38ClassRunner runner = new JUnit38ClassRunner(new JUnit4TestAdapter(AnnotatedTest.class));
Result result = new JUnitCore().run(runner);
Failure failure = result.getFailures().get(0);
assertEquals(Description.createTestDescription(AnnotatedTest.class, "foo"), failure.getDescription());
}
use of org.junit.runner.Result 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());
}
Aggregations