public class MessageFormatter
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) DescriptionFormatter |
descriptionFormatter |
private static MessageFormatter |
INSTANCE |
Constructor and Description |
---|
MessageFormatter() |
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
asText(Representation p,
java.lang.Object o) |
java.lang.String |
format(Description d,
Representation p,
java.lang.String format,
java.lang.Object... args)
Interprets a printf-style format
String for failed assertion messages. |
private java.lang.Object[] |
format(Representation p,
java.lang.Object[] args) |
static MessageFormatter |
instance() |
private static final MessageFormatter INSTANCE
DescriptionFormatter descriptionFormatter
public static MessageFormatter instance()
public java.lang.String format(Description d, Representation p, java.lang.String format, java.lang.Object... args)
String
for failed assertion messages. It is similar to
String.format(String, Object...)
, except for:
Description
is used as the first argument referenced in the format
stringString
by invoking
Representation.toStringOf(Object)
.
d
- the description of the failed assertion, may be null
.p
- the Representation usedformat
- the format string.args
- arguments referenced by the format specifiers in the format string.String
.java.lang.NullPointerException
- if the format string is null
.private java.lang.Object[] format(Representation p, java.lang.Object[] args)
private java.lang.String asText(Representation p, java.lang.Object o)