Search in sources :

Example 11 with PrintableResult

use of org.junit.experimental.results.PrintableResult in project junit4 by junit-team.

the class TestWatcherTest method testWatcherSkippedThrowsException.

@Test
public void testWatcherSkippedThrowsException() {
    PrintableResult result = testResult(TestWatcherSkippedThrowsExceptionTest.class);
    assertThat(result, failureCountIs(2));
    assertThat(result, hasFailureContaining("test failure"));
    assertThat(result, hasFailureContaining("watcher failure"));
}
Also used : PrintableResult(org.junit.experimental.results.PrintableResult) Test(org.junit.Test)

Example 12 with PrintableResult

use of org.junit.experimental.results.PrintableResult in project junit4 by junit-team.

the class TestWatcherTest method testWatcherFailedAndFinishedThrowsException.

@Test
public void testWatcherFailedAndFinishedThrowsException() {
    PrintableResult result = testResult(TestWatcherFailedAndFinishedThrowsExceptionTest.class);
    assertThat(result, failureCountIs(3));
    assertThat(result, hasFailureContaining("test failure"));
    assertThat(result, hasFailureContaining("watcher failed failure"));
    assertThat(result, hasFailureContaining("watcher finished failure"));
}
Also used : PrintableResult(org.junit.experimental.results.PrintableResult) Test(org.junit.Test)

Example 13 with PrintableResult

use of org.junit.experimental.results.PrintableResult in project junit4 by junit-team.

the class VerifierRuleTest method usedErrorCollectorCheckThrowsNothingThrownShouldFail.

@Test
public void usedErrorCollectorCheckThrowsNothingThrownShouldFail() {
    PrintableResult testResult = testResult(UsesErrorCollectorCheckThrowsNothingThrown.class);
    assertThat(testResult, hasFailureContaining("but nothing was thrown"));
}
Also used : PrintableResult(org.junit.experimental.results.PrintableResult) Test(org.junit.Test)

Example 14 with PrintableResult

use of org.junit.experimental.results.PrintableResult in project junit4 by junit-team.

the class VerifierRuleTest method usedErrorCollectorCheckSucceedsWithAssumptionViolatedExceptionShouldFail.

@Test
public void usedErrorCollectorCheckSucceedsWithAssumptionViolatedExceptionShouldFail() {
    PrintableResult testResult = testResult(UsesErrorCollectorCheckSucceedsWithAssumptionViolatedException.class);
    assertThat(testResult, hasSingleFailureMatching(CoreMatchers.<Throwable>instanceOf(AssertionError.class)));
    assertThat(testResult, hasFailureContaining("Callable threw AssumptionViolatedException"));
}
Also used : PrintableResult(org.junit.experimental.results.PrintableResult) Test(org.junit.Test)

Example 15 with PrintableResult

use of org.junit.experimental.results.PrintableResult in project junit4 by junit-team.

the class VerifierRuleTest method usedErrorCollectorCheckSucceedsShouldPass.

@Test
public void usedErrorCollectorCheckSucceedsShouldPass() {
    PrintableResult testResult = testResult(UsesErrorCollectorCheckSucceedsPasses.class);
    assertThat(testResult, isSuccessful());
}
Also used : PrintableResult(org.junit.experimental.results.PrintableResult) Test(org.junit.Test)

Aggregations

PrintableResult (org.junit.experimental.results.PrintableResult)29 Test (org.junit.Test)27 Failure (org.junit.runner.notification.Failure)4 Theory (org.junit.experimental.theories.Theory)2