Search in sources :

Example 1 with BasicErrorMessageFactory

use of org.assertj.core.error.BasicErrorMessageFactory in project gwt-test-utils by gwt-test-utils.

the class GwtGenericAssert method failWithMessage.

/**
     * Returns a <code>{@link AssertionError}</code> describing an assertion failure. A default
     * description is set if the default error message is not overrided and a custom description is
     * not applied. In both case, the resulting description would be prefixed by the message
     * eventually supplied through {@link GwtGenericAssert#withPrefix(String)}.
     *
     * @param format    the format string.
     * @param arguments arguments referenced by the format specifiers in the format string.
     * @return a {@code AssertionError} describing the assertion failure based on the supplied
     * message.
     */
@Override
protected void failWithMessage(String format, Object... arguments) {
    GwtWritableAssertionInfo info = new GwtWritableAssertionInfo();
    info.prefix(gwtInfo.prefix());
    info.overridingErrorMessage(gwtInfo.overridingErrorMessage());
    Description d = gwtInfo.superDescription();
    String newDescription = d != null ? d.value() : this.actual.getClass().getSimpleName();
    info.description(newDescription);
    throw failures.failure(info, new BasicErrorMessageFactory(format, arguments));
}
Also used : Description(org.assertj.core.description.Description) BasicErrorMessageFactory(org.assertj.core.error.BasicErrorMessageFactory)

Example 2 with BasicErrorMessageFactory

use of org.assertj.core.error.BasicErrorMessageFactory in project assertj-core by joel-costigliola.

the class BasicErrorMessageFactory_equals_hashCode_Test method should_have_transitive_equals.

@Test
public void should_have_transitive_equals() {
    BasicErrorMessageFactory obj2 = new BasicErrorMessageFactory("Hello %s", "Yoda");
    BasicErrorMessageFactory obj3 = new BasicErrorMessageFactory("Hello %s", "Yoda");
    assertEqualsIsTransitive(factory, obj2, obj3);
}
Also used : BasicErrorMessageFactory(org.assertj.core.error.BasicErrorMessageFactory)

Aggregations

BasicErrorMessageFactory (org.assertj.core.error.BasicErrorMessageFactory)2 Description (org.assertj.core.description.Description)1