@Test
public void testUnescape() throws Exception {

    assertEquals("", unescape(""));
    assertEquals("a", unescape("a"));
    assertEquals("abc", unescape("abc"));
    assertEquals("_", unescape("__"));
    assertEquals("__", unescape("____"));
    assertEquals("_a", unescape("__a"));
    assertEquals("_abc", unescape("__abc"));
    assertEquals("a_", unescape("a__"));
    assertEquals("abc_", unescape("abc__"));
    assertEquals("some_test", unescape("some__test"));
    assertEquals("\u0000", unescape("_x00"));
    assertEquals("\u0001", unescape("_x01"));
    assertEquals("\u0010", unescape("_x10"));
    assertEquals("\u0077", unescape("_x77"));
    assertEquals("\u00A9", unescape("_xa9"));
    assertEquals("\u00FF", unescape("_xFF"));
    assertEquals("\u00FF", unescape("_xff"));
    assertEquals(".", unescape("_x2e"));
    assertEquals("\u0000", unescape("_u0000"));
    assertEquals("\u0001", unescape("_u0001"));
    assertEquals("\uE1A4", unescape("_ue1a4"));
    assertEquals("\uF000", unescape("_uF000"));
    assertEquals("\uFFFF", unescape("_uFFFF"));
    assertEquals(".", unescape("_u002E"));
    assertEquals("Embedded_underscores\u0312unicode\u0045etc", unescape("Embedded__underscores_u0312unicode_x45etc"));
    try {
        unescape("_");
        fail();
    } catch (IllegalArgumentException e) {
        System.out.println(e.getMessage());
    }
    try {
        unescape("some _a string");
        fail();
    } catch (IllegalArgumentException e) {
        System.out.println(e.getMessage());
    }
    try {
        unescape("_x");
        fail();
    } catch (IllegalArgumentException e) {
        System.out.println(e.getMessage());
    }
    try {
        unescape("_x0");
        fail();
    } catch (IllegalArgumentException e) {
        System.out.println(e.getMessage());
    }
    try {
        unescape("_u");
        fail();
    } catch (IllegalArgumentException e) {
        System.out.println(e.getMessage());
    }
    try {
        unescape("_u-1aaa");
        fail();
    } catch (IllegalArgumentException e) {
        System.out.println(e.getMessage());
    }
    try {
        unescape("_u1zaa");
        fail();
    } catch (IllegalArgumentException e) {
        System.out.println(e.getMessage());
    }
    try {
        unescape("embedded _x 00 into string");
        fail();
    } catch (IllegalArgumentException e) {
        System.out.println(e.getMessage());
    }
    try {
        unescape("embedded _x0 into string");
        fail();
    } catch (IllegalArgumentException e) {
        System.out.println(e.getMessage());
    }
    try {
        unescape("embedded _u012 into string");
        fail();
    } catch (IllegalArgumentException e) {
        System.out.println(e.getMessage());
    }
}