org.fest.assertions.error
Class MessageFormatter

java.lang.Object
  extended by org.fest.assertions.error.MessageFormatter

public class MessageFormatter
extends Object

Formats the messages to be included in assertion errors.

Author:
Alex Ruiz

Method Summary
 String format(Description d, String format, Object... args)
          Interprets a printf-style format String for failed assertion messages.
static MessageFormatter instance()
          Returns the singleton instance of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static MessageFormatter instance()
Returns the singleton instance of this class.

Returns:
the singleton instance of this class.

format

public String format(Description d,
                     String format,
                     Object... args)
Interprets a printf-style format String for failed assertion messages. It is similar to String.format(String, Object...), except for:
  1. the value of the given Description is used as the first argument referenced in the format string
  2. each of the arguments in the given array is converted to a String by invoking ToString.toStringOf(Object).

Parameters:
d - the description of the failed assertion, may be null.
format - the format string.
args - arguments referenced by the format specifiers in the format string.
Returns:
A formatted String.
Throws:
NullPointerException - if the format string is null.


Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.