use of org.junit.runner.Result in project junit4 by junit-team.
the class CategoryTest method sameAsNoIncludeCategoryAnnotation.
@Test
public void sameAsNoIncludeCategoryAnnotation() {
Result testResult = JUnitCore.runClasses(SameAsNoIncludeCategoryAnnotationSuite.class);
assertTrue(testResult.wasSuccessful());
assertEquals(1, testResult.getRunCount());
}
use of org.junit.runner.Result in project junit4 by junit-team.
the class CategoryTest method testCountWithExplicitExcludeFilter.
@Test
public void testCountWithExplicitExcludeFilter() throws Throwable {
CategoryFilter include = CategoryFilter.exclude(SlowTests.class);
Request baseRequest = Request.aClass(TestSuiteWithNoCategories.class);
Result result = new JUnitCore().run(baseRequest.filterWith(include));
assertEquals(2, result.getFailureCount());
assertEquals(2, result.getRunCount());
}
use of org.junit.runner.Result in project junit4 by junit-team.
the class CategoryTest method testInheritance.
@Test
public void testInheritance() {
Result result = JUnitCore.runClasses(InheritanceSuite.class);
assertEquals(1, result.getRunCount());
assertTrue(result.wasSuccessful());
}
use of org.junit.runner.Result in project junit4 by junit-team.
the class CategoryTest method ignoredTest.
@Test
public void ignoredTest() {
// behaves same as Suite
Result result = JUnitCore.runClasses(IgnoredTestCategoriesSuite.class);
assertFalse(result.wasSuccessful());
assertThat(result.getRunCount(), is(1));
assertThat(result.getFailureCount(), is(1));
assertThat(result.getIgnoreCount(), is(1));
}
use of org.junit.runner.Result in project junit4 by junit-team.
the class StackTracesTest method getTrimmedStackForJUnit4TestFailingInMethodRule.
@Test
public void getTrimmedStackForJUnit4TestFailingInMethodRule() {
Result result = runTest(TestWithThrowingMethodRule.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$ThrowingMethodRule.apply"));
assertNotEquals(failure.getTrace(), failure.getTrimmedTrace());
}
Aggregations