/** * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ public static String toString(SelfDescribing selfDescribing) { return new StringDescription().appendDescriptionOf(selfDescribing).toString(); }
/** * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ public static String toString(SelfDescribing selfDescribing) { return new StringDescription().appendDescriptionOf(selfDescribing).toString(); }
/** * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ public static String toString(SelfDescribing selfDescribing) { return new StringDescription().appendDescriptionOf(selfDescribing).toString(); }
public void assertContainsMessageMatching( Matcher<String> messageMatcher ) { synchronized ( logCalls ) { for ( LogCall logCall : logCalls ) { if ( messageMatcher.matches( logCall.message ) ) { return; } } StringDescription description = new StringDescription(); description.appendDescriptionOf( messageMatcher ); fail( format( "Expected at least one log statement with message as %s, but none found. Actual log calls were:\n%s", description.toString(), serialize( logCalls.iterator() ) ) ); } }
@SafeVarargs public final void assertContainsLogCallsMatching( int logSkipCount, Matcher<String>... matchers ) { synchronized ( logCalls ) { assertEquals( logCalls.size(), logSkipCount + matchers.length ); for ( int i = 0; i < matchers.length; i++ ) { LogCall logCall = logCalls.get( logSkipCount + i ); Matcher<String> matcher = matchers[i]; if ( !matcher.matches( logCall.message ) ) { StringDescription description = new StringDescription(); description.appendDescriptionOf( matcher ); fail( format( "Expected log statement with message as %s, but none found. Actual log call was:\n%s", description.toString(), logCall.toString() ) ); } } } }
description.appendDescriptionOf( messageMatcher ); fail( format( "Expected exactly one log statement with message as %s, but multiple found. Actual log calls were:%n%s", description.toString(), serialize( logCalls.iterator() ) ) ); description.appendDescriptionOf( messageMatcher ); fail( format( "Expected at least one log statement with message as %s, but none found. Actual log calls were:\n%s",
/** * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ public static String toString(SelfDescribing selfDescribing) { return new StringDescription().appendDescriptionOf(selfDescribing).toString(); }
/** * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ public static String toString(SelfDescribing selfDescribing) { return new StringDescription().appendDescriptionOf(selfDescribing).toString(); }
/** * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ public static String toString(SelfDescribing selfDescribing) { return new StringDescription().appendDescriptionOf(selfDescribing).toString(); }
/** * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ public static String toString(SelfDescribing selfDescribing) { return new StringDescription().appendDescriptionOf(selfDescribing).toString(); }
/** * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ public static String toString(SelfDescribing selfDescribing) { return new StringDescription().appendDescriptionOf(selfDescribing).toString(); }
/** * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ public static String toString(SelfDescribing selfDescribing) { return new StringDescription().appendDescriptionOf(selfDescribing).toString(); }
/** * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ public static String toString(SelfDescribing selfDescribing) { return new StringDescription().appendDescriptionOf(selfDescribing).toString(); }
/** * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ public static String toString(SelfDescribing selfDescribing) { return new StringDescription().appendDescriptionOf(selfDescribing).toString(); }
/** * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ public static String toString(SelfDescribing selfDescribing) { return new StringDescription().appendDescriptionOf(selfDescribing).toString(); }
/** * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ public static String toString(SelfDescribing selfDescribing) { return new StringDescription().appendDescriptionOf(selfDescribing).toString(); }
/** * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ public static String toString(SelfDescribing selfDescribing) { return new StringDescription().appendDescriptionOf(selfDescribing).toString(); }
/** * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ public static String toString(SelfDescribing selfDescribing) { return new StringDescription().appendDescriptionOf(selfDescribing).toString(); }
/** * Return the description of a {@link SelfDescribing} object as a String. * * @param selfDescribing * The object to be described. * @return * The description of the object. */ public static String toString(SelfDescribing selfDescribing) { return new StringDescription().appendDescriptionOf(selfDescribing).toString(); }
static <T> void assertMismatchDescription(Object value, Matcher<T> matcher, Matcher<String> expectedDescription, Matcher<String> expectedMismatchDescription) { final Description matcherDescription = new StringDescription().appendDescriptionOf(matcher); assertThat(matcherDescription.toString(), expectedDescription); final StringDescription d = new StringDescription(); matcher.describeMismatch(value, d); assertThat(d.toString(), expectedMismatchDescription); } }