Class EscaperAsserts
java.lang.Object
com.google.common.escape.testing.EscaperAsserts
Extra assert methods for testing Escaper implementations.
- Since:
- 15.0
- Author:
- David Beaumont
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertBasic(com.google.common.escape.Escaper escaper) Asserts that an escaper behaves correctly with respect to null inputs.static voidassertEscaping(com.google.common.escape.CharEscaper escaper, String expected, char c) Asserts that an escaper escapes the given character into the expected string.static voidassertEscaping(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 voidassertUnescaped(com.google.common.escape.CharEscaper escaper, char c) Asserts that an escaper does not escape the given character.static voidassertUnescaped(com.google.common.escape.UnicodeEscaper escaper, int cp) Asserts that a Unicode escaper does not escape the given character.static voidassertUnicodeEscaping(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.
-
Method Details
-
assertBasic
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 testexpected- the expected output stringc- 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 testexpected- the expected output stringcp- the Unicode code point to escape
-
assertUnescaped
Asserts that an escaper does not escape the given character.- Parameters:
escaper- the non-null escaper to testc- the character to test
-
assertUnescaped
Asserts that a Unicode escaper does not escape the given character.- Parameters:
escaper- the non-null escaper to testcp- 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 testexpected- the expected output stringhi- the high surrogate pair characterlo- the low surrogate pair character
-