Class Formatting

java.lang.Object
org.fest.assertions.Formatting

public final class Formatting extends Object
Provides utility methods related to formatting.
  • Field Details

  • Constructor Details

    • Formatting

      private Formatting()
  • Method Details

    • createMessageFrom

      static String createMessageFrom(Description description, Object[] message)
    • format

      public static String format(Description description, String message)
      Returns the given message formatted as follows:
       [description] message.
       
      Parameters:
      description - the description of the actual value in the failed assertion. It can be null.
      message - the message to format.
      Returns:
      the formatted message.
      Since:
      1.2
    • valueOf

      public static String valueOf(Description description)
      Returns the value of the given Description.
      Parameters:
      description - the given Description.
      Returns:
      the value of the given Description, or null if the given Description is null.
    • format

      public static String format(String message)
      Formats the given message:
    • if it is null or empty, an empty String is returned, otherwise uses the following format:
       [message]{whitespace}
       
    • Parameters:
      message - the message to format.
      Returns:
      the formatted message.
    • inBrackets

      public static String inBrackets(Object o)
      Returns the String representation of the given object in between brackets ("<" and ">"). This method has special support for arrays, Class<?>, Collections, Maps, Files and Dimensions. For any other types, this method simply calls its toString implementation.
      Parameters:
      o - the given object.
      Returns:
      the String representation of the given object in between brackets.
    • doBracketAround

      private static String doBracketAround(Object o)