Class GroovyStyleToString

java.lang.Object
io.restassured.internal.common.util.GroovyStyleToString

public class GroovyStyleToString extends Object
Renders values the way a dynamically dispatched value.toString() does in Groovy, which is what users saw when this code was written in Groovy. For example a byte[] is rendered as [65, 66] (not [B@1b6d3586), a map as [a:1] (not {a=1}), a char[] as the string it holds and a DOM element as XML. Values whose class overrides toString() in a way Groovy can call use their own toString().
  • Method Details

    • toString

      public static String toString(Object value)
      Parameters:
      value - The value
      Returns:
      value rendered like Groovy's value.toString().
    • serialize

      public static String serialize(Element element)
      Parameters:
      element - The element
      Returns:
      The element as pretty-printed XML, the same as Groovy's XmlUtil.serialize(Element).
    • format

      public static String format(Object value)
      Port of Groovy's InvokerHelper.format(Object, verbose = false), which is what Groovy uses when it casts a value to String or interpolates it in a GString. Unlike toString(Object) it formats every map and collection, even one whose class has its own toString().
      Parameters:
      value - The value
      Returns:
      value formatted like Groovy's InvokerHelper.format(value, false).