Package org.assertj.core.error
Class MessageFormatter
- java.lang.Object
-
- org.assertj.core.error.MessageFormatter
-
public class MessageFormatter extends java.lang.ObjectFormats the messages to be included in assertion errors.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) DescriptionFormatterdescriptionFormatterprivate static MessageFormatterINSTANCE
-
Constructor Summary
Constructors Constructor Description MessageFormatter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.StringasText(Representation p, java.lang.Object o)java.lang.Stringformat(Description d, Representation p, java.lang.String format, java.lang.Object... args)Interprets a printf-style formatStringfor failed assertion messages.private java.lang.Object[]format(Representation p, java.lang.Object[] args)static MessageFormatterinstance()
-
-
-
Field Detail
-
INSTANCE
private static final MessageFormatter INSTANCE
-
descriptionFormatter
DescriptionFormatter descriptionFormatter
-
-
Method Detail
-
instance
public static MessageFormatter instance()
-
format
public java.lang.String format(Description d, Representation p, java.lang.String format, java.lang.Object... args)
Interprets a printf-style formatStringfor failed assertion messages. It is similar to, except for:String.format(String, Object...)- the value of the given
is used as the first argument referenced in the format stringDescription - each of the arguments in the given array is converted to a
Stringby invoking.Representation.toStringOf(Object)
- Parameters:
d- the description of the failed assertion, may benull.p- the Representation usedformat- the format string.args- arguments referenced by the format specifiers in the format string.- Returns:
- A formatted
String. - Throws:
java.lang.NullPointerException- if the format string isnull.
- the value of the given
-
format
private java.lang.Object[] format(Representation p, java.lang.Object[] args)
-
asText
private java.lang.String asText(Representation p, java.lang.Object o)
-
-