Class EscaperAsserts

java.lang.Object
com.google.common.escape.testing.EscaperAsserts

@GwtCompatible public final class EscaperAsserts extends Object
Extra assert methods for testing Escaper implementations.
Since:
15.0
Author:
David Beaumont
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    assertBasic(com.google.common.escape.Escaper escaper)
    Asserts that an escaper behaves correctly with respect to null inputs.
    static void
    assertEscaping(com.google.common.escape.CharEscaper escaper, String expected, char c)
    Asserts that an escaper escapes the given character into the expected string.
    static void
    assertEscaping(com.google.common.escape.UnicodeEscaper escaper, String expected, int cp)
    Asserts that a Unicode escaper escapes the given code point into the expected string.
    static void
    assertUnescaped(com.google.common.escape.CharEscaper escaper, char c)
    Asserts that an escaper does not escape the given character.
    static void
    assertUnescaped(com.google.common.escape.UnicodeEscaper escaper, int cp)
    Asserts that a Unicode escaper does not escape the given character.
    static void
    assertUnicodeEscaping(com.google.common.escape.UnicodeEscaper escaper, String expected, char hi, char lo)
    Asserts that a Unicode escaper escapes the given hi/lo surrogate pair into the expected string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • assertBasic

      public static void assertBasic(com.google.common.escape.Escaper escaper) throws IOException
      Asserts that an escaper behaves correctly with respect to null inputs.
      Parameters:
      escaper - the non-null escaper to test
      Throws:
      IOException
    • assertEscaping

      public static void assertEscaping(com.google.common.escape.CharEscaper escaper, String expected, char c)
      Asserts that an escaper escapes the given character into the expected string.
      Parameters:
      escaper - the non-null escaper to test
      expected - the expected output string
      c - the character to escape
    • assertEscaping

      public static void assertEscaping(com.google.common.escape.UnicodeEscaper escaper, String expected, int cp)
      Asserts that a Unicode escaper escapes the given code point into the expected string.
      Parameters:
      escaper - the non-null escaper to test
      expected - the expected output string
      cp - the Unicode code point to escape
    • assertUnescaped

      public static void assertUnescaped(com.google.common.escape.CharEscaper escaper, char c)
      Asserts that an escaper does not escape the given character.
      Parameters:
      escaper - the non-null escaper to test
      c - the character to test
    • assertUnescaped

      public static void assertUnescaped(com.google.common.escape.UnicodeEscaper escaper, int cp)
      Asserts that a Unicode escaper does not escape the given character.
      Parameters:
      escaper - the non-null escaper to test
      cp - the Unicode code point to test
    • assertUnicodeEscaping

      public static void assertUnicodeEscaping(com.google.common.escape.UnicodeEscaper escaper, String expected, char hi, char lo)
      Asserts that a Unicode escaper escapes the given hi/lo surrogate pair into the expected string.
      Parameters:
      escaper - the non-null escaper to test
      expected - the expected output string
      hi - the high surrogate pair character
      lo - the low surrogate pair character