Class DefaultFormatter<T>

java.lang.Object
com.tngtech.jgiven.format.DefaultFormatter<T>
All Implemented Interfaces:
ArgumentFormatter<T>, Formatter<T>, ObjectFormatter<T>
Direct Known Subclasses:
DefaultObjectFormatter

public class DefaultFormatter<T> extends Object implements ArgumentFormatter<T>, Formatter<T>, ObjectFormatter<T>
A default formatter that merely use String.valueOf(Object), except for arrays where Arrays.deepToString(Object[]) is used.
  • Field Details

  • Constructor Details

    • DefaultFormatter

      public DefaultFormatter()
  • Method Details

    • format

      @Nonnull public String format(@Nullable T argumentToFormat, @Nullable String... formatterArguments)
      Description copied from interface: ArgumentFormatter
      Format a single argument by taking optional formatter arguments into account.
      Specified by:
      format in interface ArgumentFormatter<T>
      Parameters:
      argumentToFormat - the object to format
      formatterArguments - optional arguments for the formatter to control the formatting.
      Returns:
      a formatted string
    • format

      @Nonnull public String format(@Nullable T argumentToFormat, @Nullable Annotation... annotations)
      Description copied from interface: Formatter
      Formats a step method argument.
      Specified by:
      format in interface Formatter<T>
      Parameters:
      argumentToFormat - the argument object to format
      annotations - list of annotations that the method parameter is annotated with
      Returns:
      a formatted string
    • format

      @Nonnull public String format(@Nullable T argumentToFormat)
      Specified by:
      format in interface ObjectFormatter<T>