### Question:
XMLUtils { public static String unmangleXmlString(String str) throws UnmanglingError { int slashPosition = -1; String escapedCp = ""; StringBuilder bld = new StringBuilder(); for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); if ((slashPosition >= 0) && (slashPosition < NUM_SLASH_POSITIONS)) { escapedCp += ch; ++slashPosition; } else if (slashPosition == NUM_SLASH_POSITIONS) { if (ch != ';') { throw new UnmanglingError("unterminated code point escape: " + "expected semicolon at end."); } try { bld.appendCodePoint(Integer.parseInt(escapedCp, 16)); } catch (NumberFormatException e) { throw new UnmanglingError("error parsing unmangling escape code", e); } escapedCp = ""; slashPosition = -1; } else if (ch == '\\') { slashPosition = 0; } else { bld.append(ch); } } if (slashPosition != -1) { throw new UnmanglingError("unterminated code point escape: string " + "broke off in the middle"); } return bld.toString(); }  static String mangleXmlString(String str); static String unmangleXmlString(String str); static void addSaxString(ContentHandler contentHandler,
      String tag, String val);  }### Answer:
@Test public void testInvalidSequence() throws Exception { try { XMLUtils.unmangleXmlString("\\000g;foo"); Assert.fail("expected an unmangling error"); } catch (UnmanglingError e) { } try { XMLUtils.unmangleXmlString("\\0"); Assert.fail("expected an unmangling error"); } catch (UnmanglingError e) { } }