Search in sources :

Example 6 with PrintableResult

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

the class WithUnresolvedGenericTypeVariablesOnTheoryParms method whereTypeVariableIsOnWildcardLowerBoundOnTheoryParm.

@Test
public void whereTypeVariableIsOnWildcardLowerBoundOnTheoryParm() {
    PrintableResult result = testResult(TypeVariableOnWildcardLowerBoundOnTheoryParm.class);
    assertThat(result, hasSingleFailureContaining("unresolved type variable V"));
}
Also used : PrintableResult(org.junit.experimental.results.PrintableResult) Test(org.junit.Test)

Example 7 with PrintableResult

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

the class UnsuccessfulWithDataPointFields method dataPointMethodsMustBePublic.

@Test
public void dataPointMethodsMustBePublic() {
    PrintableResult result = testResult(DataPointMethodsMustBePublic.class);
    assertThat(result, allOf(hasFailureContaining("DataPoint method three must be public"), hasFailureContaining("DataPoint method threes must be public"), hasFailureContaining("DataPoint method four must be public"), hasFailureContaining("DataPoint method fours must be public"), hasFailureContaining("DataPoint method five must be public"), hasFailureContaining("DataPoint method fives must be public")));
}
Also used : PrintableResult(org.junit.experimental.results.PrintableResult) Test(org.junit.Test)

Example 8 with PrintableResult

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

the class WithUnresolvedGenericTypeVariablesOnTheoryParms method whereTypeVariableIsOnComponentOfArrayTypeOnTheoryParm.

@Test
public void whereTypeVariableIsOnComponentOfArrayTypeOnTheoryParm() {
    PrintableResult result = testResult(TypeVariableOnComponentOfArrayTypeOnTheoryParm.class);
    assertThat(result, hasSingleFailureContaining("unresolved type variable U"));
}
Also used : PrintableResult(org.junit.experimental.results.PrintableResult) Test(org.junit.Test)

Example 9 with PrintableResult

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

the class PrintableResultTest method includeMultipleFailures.

@Theory
public void includeMultipleFailures(String secondExceptionName) {
    PrintableResult backtrace = new PrintableResult(Arrays.asList(new Failure(Description.createSuiteDescription("firstName"), new RuntimeException("firstException")), new Failure(Description.createSuiteDescription("secondName"), new RuntimeException(secondExceptionName))));
    assertThat(backtrace.toString(), containsString(secondExceptionName));
}
Also used : PrintableResult(org.junit.experimental.results.PrintableResult) Failure(org.junit.runner.notification.Failure) Theory(org.junit.experimental.theories.Theory)

Example 10 with PrintableResult

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

the class PrintableResultTest method backTraceHasGoodToString.

@Theory(nullsAccepted = false)
public void backTraceHasGoodToString(String descriptionName, final String stackTraceClassName) {
    Failure failure = new Failure(Description.createSuiteDescription(descriptionName), new Throwable() {

        private static final long serialVersionUID = 1L;

        @Override
        public StackTraceElement[] getStackTrace() {
            return new StackTraceElement[] { new StackTraceElement(stackTraceClassName, "methodName", "fileName", 1) };
        }
    });
    assertThat(new PrintableResult(asList(failure)).toString(), allOf(containsString(descriptionName), containsString(stackTraceClassName)));
}
Also used : PrintableResult(org.junit.experimental.results.PrintableResult) Failure(org.junit.runner.notification.Failure) Theory(org.junit.experimental.theories.Theory)

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