@Override public String value() { return formatIfArgs(value, args); }
@Override public String value() { return formatIfArgs(value, args); }
/** * Overrides AssertJ default error message by the given one. * <p> * You must set it <b>before</b> calling the assertion otherwise it is ignored as the failing assertion breaks * the chained call by throwing an AssertionError. * <p> * The new error message is built using {@link String#format(String, Object...)} if you provide args parameter (if you * don't, the error message is taken as it is). * <p> * Example : * <pre><code class='java'>assertThat(player.isRookie()).overridingErrorMessage("Expecting Player <%s> to be a rookie but was not.", player) * .isTrue();</code></pre> * * @param newErrorMessage the error message that will replace the default one provided by Assertj. * @param args the args used to fill error message as in {@link String#format(String, Object...)}. * @return this assertion object. */ @CheckReturnValue public SELF overridingErrorMessage(String newErrorMessage, Object... args) { info.overridingErrorMessage(formatIfArgs(newErrorMessage, args)); return myself; }
/** * Overrides AssertJ default error message by the given one. * <p> * You must set it <b>before</b> calling the assertion otherwise it is ignored as the failing assertion breaks * the chained call by throwing an AssertionError. * <p> * The new error message is built using {@link String#format(String, Object...)} if you provide args parameter (if you * don't, the error message is taken as it is). * <p> * Example : * <pre><code class='java'>assertThat(player.isRookie()).overridingErrorMessage("Expecting Player <%s> to be a rookie but was not.", player) * .isTrue();</code></pre> * * @param newErrorMessage the error message that will replace the default one provided by Assertj. * @param args the args used to fill error message as in {@link String#format(String, Object...)}. * @return this assertion object. */ @CheckReturnValue public SELF overridingErrorMessage(String newErrorMessage, Object... args) { info.overridingErrorMessage(formatIfArgs(newErrorMessage, args)); return myself; }
/** * Interprets a printf-style format {@code String} for failed assertion messages. It is similar to * <code>{@link String#format(String, Object...)}</code>, except for: * <ol> * <li>the value of the given <code>{@link Description}</code> is used as the first argument referenced in the format * string</li> * <li>each of the arguments in the given array is converted to a {@code String} by invoking * <code>{@link org.assertj.core.presentation.Representation#toStringOf(Object)}</code>. * </ol> * * @param d the description of the failed assertion, may be {@code null}. * @param p the Representation used * @param format the format string. * @param args arguments referenced by the format specifiers in the format string. * @throws NullPointerException if the format string is {@code null}. * @return A formatted {@code String}. */ public String format(Description d, Representation p, String format, Object... args) { checkNotNull(format); checkNotNull(args); return descriptionFormatter.format(d) + formatIfArgs(format, format(p, args)); }
/** * Interprets a printf-style format {@code String} for failed assertion messages. It is similar to * <code>{@link String#format(String, Object...)}</code>, except for: * <ol> * <li>the value of the given <code>{@link Description}</code> is used as the first argument referenced in the format * string</li> * <li>each of the arguments in the given array is converted to a {@code String} by invoking * <code>{@link org.assertj.core.presentation.Representation#toStringOf(Object)}</code>. * </ol> * * @param d the description of the failed assertion, may be {@code null}. * @param p the Representation used * @param format the format string. * @param args arguments referenced by the format specifiers in the format string. * @throws NullPointerException if the format string is {@code null}. * @return A formatted {@code String}. */ public String format(Description d, Representation p, String format, Object... args) { checkNotNull(format); checkNotNull(args); return descriptionFormatter.format(d) + formatIfArgs(format, format(p, args)); }
@Override public String value() { return formatIfArgs(value, args); }
/** * Overrides AssertJ default error message by the given one. * <p> * The new error message is built using {@link String#format(String, Object...)} if you provide args parameter (if you * don't, the error message is taken as it is). * <p> * Example : * * <pre><code class='java'> * assertThat(player.isRookie()).overridingErrorMessage("Expecting Player <%s> to be a rookie but was not.", player) * .isTrue(); * </code></pre> * * @param newErrorMessage the error message that will replace the default one provided by Assertj. * @param args the args used to fill error message as in {@link String#format(String, Object...)}. * @return this assertion object. * @throws Exception see {@link String#format(String, Object...)} exception clause. */ public S overridingErrorMessage(String newErrorMessage, Object... args) { info.overridingErrorMessage(formatIfArgs(newErrorMessage, args)); return myself; }
/** * Interprets a printf-style format {@code String} for failed assertion messages. It is similar to * <code>{@link String#format(String, Object...)}</code>, except for: * <ol> * <li>the value of the given <code>{@link Description}</code> is used as the first argument referenced in the format * string</li> * <li>each of the arguments in the given array is converted to a {@code String} by invoking * <code>{@link org.assertj.core.presentation.Representation#toStringOf(Object)}</code>. * </ol> * * @param d the description of the failed assertion, may be {@code null}. * @param format the format string. * @param args arguments referenced by the format specifiers in the format string. * @throws NullPointerException if the format string is {@code null}. * @return A formatted {@code String}. */ public String format(Description d, Representation p, String format, Object... args) { checkNotNull(format); checkNotNull(args); return descriptionFormatter.format(d) + formatIfArgs(format, format(p, args)); }