use of org.junit.runner.Result in project junit4 by junit-team.
the class StackTracesTest method getTrimmedStackForJUnit4TestFailingInTestRule.
@Test
public void getTrimmedStackForJUnit4TestFailingInTestRule() {
Result result = runTest(TestWithThrowingTestRule.class);
assertEquals("Should run the test", 1, result.getRunCount());
assertEquals("One test should fail", 1, result.getFailureCount());
Failure failure = result.getFailures().get(0);
assertHasTrimmedTrace(failure, message("java.lang.RuntimeException: cause"), at("org.junit.internal.StackTracesTest$FakeClassUnderTest.doThrowExceptionWithoutCause"), at("org.junit.internal.StackTracesTest$FakeClassUnderTest.throwsExceptionWithoutCause"), at("org.junit.internal.StackTracesTest$ThrowingTestRule.apply"));
assertNotEquals(failure.getTrace(), failure.getTrimmedTrace());
}
use of org.junit.runner.Result in project junit4 by junit-team.
the class StackTracesTest method getTrimmedStackForJUnit4TestFailingInBeforeMethod.
@Test
public void getTrimmedStackForJUnit4TestFailingInBeforeMethod() {
Result result = runTest(TestWithThrowingBeforeMethod.class);
assertEquals("Should run the test", 1, result.getRunCount());
assertEquals("One test should fail", 1, result.getFailureCount());
Failure failure = result.getFailures().get(0);
assertHasTrimmedTrace(failure, message("java.lang.RuntimeException: cause"), at("org.junit.internal.StackTracesTest$FakeClassUnderTest.doThrowExceptionWithoutCause"), at("org.junit.internal.StackTracesTest$FakeClassUnderTest.throwsExceptionWithoutCause"), at("org.junit.internal.StackTracesTest$TestWithThrowingBeforeMethod.alwaysThrows"));
assertNotEquals(failure.getTrace(), failure.getTrimmedTrace());
}
use of org.junit.runner.Result in project junit4 by junit-team.
the class StackTracesTest method getTrimmedStackForJUnit4TestFailingInTestMethod.
@Test
public void getTrimmedStackForJUnit4TestFailingInTestMethod() {
Result result = runTest(TestWithOneThrowingTestMethod.class);
assertEquals("Should run the test", 1, result.getRunCount());
assertEquals("One test should fail", 1, result.getFailureCount());
Failure failure = result.getFailures().get(0);
assertHasTrimmedTrace(failure, message("java.lang.RuntimeException: cause"), at("org.junit.internal.StackTracesTest$FakeClassUnderTest.doThrowExceptionWithoutCause"), at("org.junit.internal.StackTracesTest$FakeClassUnderTest.throwsExceptionWithoutCause"), at("org.junit.internal.StackTracesTest$TestWithOneThrowingTestMethod.alwaysThrows"));
assertNotEquals(failure.getTrace(), failure.getTrimmedTrace());
}
use of org.junit.runner.Result in project junit4 by junit-team.
the class JavadocTest method slowTests.
@Test
public void slowTests() {
Result testResult = JUnitCore.runClasses(SlowTestSuite.class);
assertTrue(testResult.wasSuccessful());
assertThat("unexpected run count", testResult.getRunCount(), is(2));
assertThat("unexpected failure count", testResult.getFailureCount(), is(0));
}
use of org.junit.runner.Result in project junit4 by junit-team.
the class MultiCategoryTest method inheritanceAllIncluded.
@Test
public void inheritanceAllIncluded() {
Result testResult = JUnitCore.runClasses(InheritanceAll.class);
assertThat("unexpected run count", testResult.getRunCount(), is(equalTo(1)));
assertThat("unexpected failure count", testResult.getFailureCount(), is(equalTo(0)));
assertThat("unexpected failure count", testResult.getIgnoreCount(), is(equalTo(0)));
}
Aggregations