### Question:
Utils { public static String unescape(String str) { if (str == null) { return null; } int len = str.length(); StringWriter writer = new StringWriter(len); StringBuilder unicode = new StringBuilder(4); boolean hadSlash = false; boolean inUnicode = false; for (int i = 0; i < len; i++) { char ch = str.charAt(i); if (inUnicode) { unicode.append(ch); if (unicode.length() == 4) { try { int value = Integer.parseInt(unicode.toString(), 16); writer.write((char) value); unicode.setLength(0); inUnicode = false; hadSlash = false; } catch (NumberFormatException nfe) { throw new JsonPathException("Unable to parse unicode value: " + unicode, nfe); } } continue; } if (hadSlash) { hadSlash = false; switch (ch) { case '\\': writer.write('\\'); break; case '\'': writer.write('\''); break; case '\"': writer.write('"'); break; case 'r': writer.write('\r'); break; case 'f': writer.write('\f'); break; case 't': writer.write('\t'); break; case 'n': writer.write('\n'); break; case 'b': writer.write('\b'); break; case 'u': { inUnicode = true; break; } default : writer.write(ch); break; } continue; } else if (ch == '\\') { hadSlash = true; continue; } writer.write(ch); } if (hadSlash) { writer.write('\\'); } return writer.toString(); } private  Utils(); static String join(String delimiter, String wrap, Iterable<?> objs); static String join(String delimiter, Iterable<?> objs); static String concat(CharSequence... strings); static void closeQuietly(Closeable closeable); static String escape(String str, boolean escapeSingleQuote); static String unescape(String str); static String hex(char ch); static boolean isEmpty(CharSequence cs); static T notNull(T object, String message, Object... values); static void isTrue(boolean expression, String message); static void onlyOneIsTrue(final String message, final boolean... expressions); static boolean onlyOneIsTrueNonThrow(final boolean... expressions); static T notEmpty(T chars, String message, Object... values); static String toString(Object o);  }### Answer:
@Test public void testUnescape() { Assert.assertNull(Utils.unescape(null)); Assert.assertEquals("foo", Utils.unescape("foo")); Assert.assertEquals("\\", Utils.unescape("\\")); Assert.assertEquals("\\", Utils.unescape("\\\\")); Assert.assertEquals("\'", Utils.unescape("\\\'")); Assert.assertEquals("\"", Utils.unescape("\\\"")); Assert.assertEquals("\r", Utils.unescape("\\r")); Assert.assertEquals("\f", Utils.unescape("\\f")); Assert.assertEquals("\t", Utils.unescape("\\t")); Assert.assertEquals("\n", Utils.unescape("\\n")); Assert.assertEquals("\b", Utils.unescape("\\b")); Assert.assertEquals("a", Utils.unescape("\\a")); Assert.assertEquals("\uffff", Utils.unescape("\\uffff")); }
@Test public void testUnescapeThrow() { thrown.expect(JsonPathException.class); Utils.unescape("\\uuuuu"); }