Java 类org.junit.experimental.results.PrintableResult 实例源码

项目:sosiefier    文件:PrintableResultTest.java   
@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)));
}
项目:junit    文件:PrintableResultTest.java   
@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)));
}
项目:health-and-care-developer-network    文件:PrintableResultTest.java   
@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)));
}
项目:sosiefier    文件:WithUnresolvedGenericTypeVariablesOnTheoryParms.java   
@Test
public void whereTypeVariablesAbound() {
    PrintableResult result = testResult(TypeVariablesAbound.class);
    assertThat(result, failureCountIs(7));
    assertThat(result, hasFailureContaining("unresolved type variable A"));
    assertThat(result, hasFailureContaining("unresolved type variable B"));
    assertThat(result, hasFailureContaining("unresolved type variable C"));
    assertThat(result, hasFailureContaining("unresolved type variable D"));
    assertThat(result, hasFailureContaining("unresolved type variable E"));
    assertThat(result, hasFailureContaining("unresolved type variable F"));
    assertThat(result, hasFailureContaining("unresolved type variable G"));
}
项目:sosiefier    文件:UnsuccessfulWithDataPointFields.java   
@Test
public void dataPointFieldsMustBeStatic() {
    assertThat(
            testResult(DataPointFieldsMustBeStatic.class),
            CoreMatchers.<PrintableResult>both(failureCountIs(2))
                    .and(
                            hasFailureContaining("DataPoint field THREE must be static"))
                    .and(
                            hasFailureContaining("DataPoint field FOURS must be static")));
}
项目:sosiefier    文件:UnsuccessfulWithDataPointFields.java   
@Test
public void dataPointMethodsMustBeStatic() {
    assertThat(
            testResult(DataPointMethodsMustBeStatic.class),
            CoreMatchers.<PrintableResult>both(failureCountIs(2))
            .and(
                    hasFailureContaining("DataPoint method singleDataPointMethod must be static"))
            .and(
                    hasFailureContaining("DataPoint method dataPointArrayMethod must be static")));
}
项目:sosiefier    文件:UnsuccessfulWithDataPointFields.java   
@Test
public void dataPointFieldsMustBePublic() {
    PrintableResult result = testResult(DataPointFieldsMustBePublic.class);        
    assertEquals(6, result.failureCount());

    assertThat(result,
            allOf(hasFailureContaining("DataPoint field THREE must be public"),
                  hasFailureContaining("DataPoint field THREES must be public"),
                  hasFailureContaining("DataPoint field FOUR must be public"),
                  hasFailureContaining("DataPoint field FOURS must be public"),
                  hasFailureContaining("DataPoint field FIVE must be public"),
                  hasFailureContaining("DataPoint field FIVES must be public")));
}
项目:sosiefier    文件:UnsuccessfulWithDataPointFields.java   
@Test
public void dataPointMethodsMustBePublic() {
    PrintableResult result = testResult(DataPointMethodsMustBePublic.class);        
    assertEquals(6, result.failureCount());

    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")));
}
项目:sosiefier    文件:TestWatcherTest.java   
@Test
public void testWatcherSkippedThrowsException() {
    PrintableResult result = testResult(TestWatcherSkippedThrowsExceptionTest.class);
    assertThat(result, failureCountIs(2));
    assertThat(result, hasFailureContaining("test failure"));
    assertThat(result, hasFailureContaining("watcher failure"));
}
项目:sosiefier    文件:TestWatcherTest.java   
@Test
public void testWatcherFailedThrowsException() {
    PrintableResult result = testResult(TestWatcherFailedThrowsExceptionTest.class);
    assertThat(result, failureCountIs(2));
    assertThat(result, hasFailureContaining("test failure"));
    assertThat(result, hasFailureContaining("watcher failure"));
}
项目:sosiefier    文件:TestWatcherTest.java   
@Test
public void testWatcherStartingThrowsException() {
    PrintableResult result = testResult(TestWatcherStartingThrowsExceptionTest.class);
    assertThat(result, failureCountIs(2));
    assertThat(result, hasFailureContaining("test failure"));
    assertThat(result, hasFailureContaining("watcher failure"));
}
项目:sosiefier    文件:TestWatcherTest.java   
@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"));
}
项目:sosiefier    文件:VerifierRuleTest.java   
@Test
public void usedErrorCollectorCheckThatShouldFail() {
    PrintableResult testResult = testResult(UsesErrorCollectorCheckThat.class);
    assertThat(testResult, hasFailureContaining("was <3>"));
    assertThat(testResult, hasFailureContaining("was <5>"));
    assertThat(testResult, hasFailureContaining("reason 1"));
    assertThat(testResult, hasFailureContaining("was <7>"));
    assertThat(testResult, hasFailureContaining("reason 2"));
    assertThat(testResult, hasFailureContaining("was <9>"));
}
项目:sosiefier    文件:PrintableResultTest.java   
@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));
}
项目:junit    文件:WithUnresolvedGenericTypeVariablesOnTheoryParms.java   
@Test
public void whereTypeVariablesAbound() {
    PrintableResult result = testResult(TypeVariablesAbound.class);
    assertThat(result, failureCountIs(7));
    assertThat(result, hasFailureContaining("unresolved type variable A"));
    assertThat(result, hasFailureContaining("unresolved type variable B"));
    assertThat(result, hasFailureContaining("unresolved type variable C"));
    assertThat(result, hasFailureContaining("unresolved type variable D"));
    assertThat(result, hasFailureContaining("unresolved type variable E"));
    assertThat(result, hasFailureContaining("unresolved type variable F"));
    assertThat(result, hasFailureContaining("unresolved type variable G"));
}
项目:junit    文件:UnsuccessfulWithDataPointFields.java   
@Test
public void dataPointsMustBeStatic() {
    assertThat(
            testResult(DataPointsMustBeStatic.class),
            CoreMatchers.<PrintableResult>both(failureCountIs(2))
                    .and(
                            hasFailureContaining("DataPoint field THREE must be static"))
                    .and(
                            hasFailureContaining("DataPoint field FOUR must be static")));
}
项目:junit    文件:TestWatcherTest.java   
@Test
public void testWatcherSkippedThrowsException() {
    PrintableResult result = testResult(TestWatcherSkippedThrowsExceptionTest.class);
    assertThat(result, failureCountIs(2));
    assertThat(result, hasFailureContaining("test failure"));
    assertThat(result, hasFailureContaining("watcher failure"));
}
项目:junit    文件:TestWatcherTest.java   
@Test
public void testWatcherFailedThrowsException() {
    PrintableResult result = testResult(TestWatcherFailedThrowsExceptionTest.class);
    assertThat(result, failureCountIs(2));
    assertThat(result, hasFailureContaining("test failure"));
    assertThat(result, hasFailureContaining("watcher failure"));
}
项目:junit    文件:TestWatcherTest.java   
@Test
public void testWatcherStartingThrowsException() {
    PrintableResult result = testResult(TestWatcherStartingThrowsExceptionTest.class);
    assertThat(result, failureCountIs(2));
    assertThat(result, hasFailureContaining("test failure"));
    assertThat(result, hasFailureContaining("watcher failure"));
}
项目:junit    文件:TestWatcherTest.java   
@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"));
}
项目:junit    文件:VerifierRuleTest.java   
@Test
public void usedErrorCollectorCheckThatShouldFail() {
    PrintableResult testResult = testResult(UsesErrorCollectorCheckThat.class);
    assertThat(testResult, hasFailureContaining("was <3>"));
    assertThat(testResult, hasFailureContaining("was <5>"));
    assertThat(testResult, hasFailureContaining("reason 1"));
    assertThat(testResult, hasFailureContaining("was <7>"));
    assertThat(testResult, hasFailureContaining("reason 2"));
    assertThat(testResult, hasFailureContaining("was <9>"));
}
项目:junit    文件:PrintableResultTest.java   
@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));
}
项目:health-and-care-developer-network    文件:WithUnresolvedGenericTypeVariablesOnTheoryParms.java   
@Test
public void whereTypeVariablesAbound() {
    PrintableResult result = testResult(TypeVariablesAbound.class);
    assertThat(result, failureCountIs(7));
    assertThat(result, hasFailureContaining("unresolved type variable A"));
    assertThat(result, hasFailureContaining("unresolved type variable B"));
    assertThat(result, hasFailureContaining("unresolved type variable C"));
    assertThat(result, hasFailureContaining("unresolved type variable D"));
    assertThat(result, hasFailureContaining("unresolved type variable E"));
    assertThat(result, hasFailureContaining("unresolved type variable F"));
    assertThat(result, hasFailureContaining("unresolved type variable G"));
}
项目:health-and-care-developer-network    文件:UnsuccessfulWithDataPointFields.java   
@Test
public void dataPointsMustBeStatic() {
    assertThat(
            testResult(DataPointsMustBeStatic.class),
            CoreMatchers.<PrintableResult>both(failureCountIs(2))
                    .and(
                            hasFailureContaining("DataPoint field THREE must be static"))
                    .and(
                            hasFailureContaining("DataPoint field FOUR must be static")));
}
项目:health-and-care-developer-network    文件:TestWatcherTest.java   
@Test
public void testWatcherSkippedThrowsException() {
    PrintableResult result = testResult(TestWatcherSkippedThrowsExceptionTest.class);
    assertThat(result, failureCountIs(2));
    assertThat(result, hasFailureContaining("test failure"));
    assertThat(result, hasFailureContaining("watcher failure"));
}
项目:health-and-care-developer-network    文件:TestWatcherTest.java   
@Test
public void testWatcherFailedThrowsException() {
    PrintableResult result = testResult(TestWatcherFailedThrowsExceptionTest.class);
    assertThat(result, failureCountIs(2));
    assertThat(result, hasFailureContaining("test failure"));
    assertThat(result, hasFailureContaining("watcher failure"));
}
项目:health-and-care-developer-network    文件:TestWatcherTest.java   
@Test
public void testWatcherStartingThrowsException() {
    PrintableResult result = testResult(TestWatcherStartingThrowsExceptionTest.class);
    assertThat(result, failureCountIs(2));
    assertThat(result, hasFailureContaining("test failure"));
    assertThat(result, hasFailureContaining("watcher failure"));
}
项目:health-and-care-developer-network    文件:TestWatcherTest.java   
@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"));
}
项目:health-and-care-developer-network    文件:VerifierRuleTest.java   
@Test
public void usedErrorCollectorCheckThatShouldFail() {
    PrintableResult testResult = testResult(UsesErrorCollectorCheckThat.class);
    assertThat(testResult, hasFailureContaining("was <3>"));
    assertThat(testResult, hasFailureContaining("was <5>"));
    assertThat(testResult, hasFailureContaining("reason 1"));
    assertThat(testResult, hasFailureContaining("was <7>"));
    assertThat(testResult, hasFailureContaining("reason 2"));
    assertThat(testResult, hasFailureContaining("was <9>"));
}
项目:health-and-care-developer-network    文件:PrintableResultTest.java   
@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));
}
项目:sosiefier    文件:WithUnresolvedGenericTypeVariablesOnTheoryParms.java   
@Test
public void whereTypeVariableIsOnTheTheory() {
    PrintableResult result = testResult(TypeVariableOnTheoryOnly.class);
    assertThat(result, isSuccessful());
}
项目:sosiefier    文件:WithUnresolvedGenericTypeVariablesOnTheoryParms.java   
@Test
public void whereTypeVariableIsOnTheoryParm() {
    PrintableResult result = testResult(TypeVariableOnTheoryParm.class);
    assertThat(result, hasSingleFailureContaining("unresolved type variable T"));
}
项目:sosiefier    文件:WithUnresolvedGenericTypeVariablesOnTheoryParms.java   
@Test
public void whereTypeVariableIsOnParameterizedTheoryParm() {
    PrintableResult result = testResult(TypeVariableOnParameterizedTheoryParm.class);
    assertThat(result, hasSingleFailureContaining("unresolved type variable T"));
}
项目:sosiefier    文件:WithUnresolvedGenericTypeVariablesOnTheoryParms.java   
@Test
public void whereTypeVariableIsOnWildcardUpperBoundOnTheoryParm() {
    PrintableResult result = testResult(TypeVariableOnWildcardUpperBoundOnTheoryParm.class);
    assertThat(result, hasSingleFailureContaining("unresolved type variable U"));
}
项目:sosiefier    文件:WithUnresolvedGenericTypeVariablesOnTheoryParms.java   
@Test
public void whereTypeVariableIsOnWildcardLowerBoundOnTheoryParm() {
    PrintableResult result = testResult(TypeVariableOnWildcardLowerBoundOnTheoryParm.class);
    assertThat(result, hasSingleFailureContaining("unresolved type variable V"));
}
项目:sosiefier    文件:WithUnresolvedGenericTypeVariablesOnTheoryParms.java   
@Test
public void whereTypeVariableIsOnArrayTypeOnTheoryParm() {
    PrintableResult result = testResult(TypeVariableOnArrayTypeOnTheoryParm.class);
    assertThat(result, hasSingleFailureContaining("unresolved type variable T"));
}
项目:sosiefier    文件:WithUnresolvedGenericTypeVariablesOnTheoryParms.java   
@Test
public void whereTypeVariableIsOnComponentOfArrayTypeOnTheoryParm() {
    PrintableResult result = testResult(TypeVariableOnComponentOfArrayTypeOnTheoryParm.class);
    assertThat(result, hasSingleFailureContaining("unresolved type variable U"));
}
项目:sosiefier    文件:WithUnresolvedGenericTypeVariablesOnTheoryParms.java   
@Test
public void whereTypeVariableIsOnTheoryClass() {
    PrintableResult result = testResult(TypeVariableOnTheoryClass.class);
    assertThat(result, hasSingleFailureContaining("unresolved type variable T"));
}
项目:sosiefier    文件:VerifierRuleTest.java   
@Test
public void usedErrorCollectorTwiceShouldFail() {
    PrintableResult testResult = testResult(UsesErrorCollectorTwice.class);
    assertThat(testResult, hasFailureContaining("first thing went wrong"));
    assertThat(testResult, hasFailureContaining("second thing went wrong"));
}
项目:sosiefier    文件:VerifierRuleTest.java   
@Test
public void usedErrorCollectorCheckSucceedsShouldFail() {
    PrintableResult testResult = testResult(UsesErrorCollectorCheckSucceeds.class);
    assertThat(testResult, hasFailureContaining("first!"));
    assertThat(testResult, hasFailureContaining("second!"));
}