public void testBuildMalformedDocumentWithUnpairedSurrogate() 
      throws IOException {
        String doc = "<doc>A\uD800A</doc>";
        try {
            builder.build(doc, "http://www.example.com");   
            fail("Allowed malformed doc");
        }
        catch (ParsingException success) {
            assertNotNull(success.getMessage());
            assertEquals("http://www.example.com/", success.getURI());
        }
    }
public void testBuildMalformedDocumentWithUnpairedSurrogate() 
      throws IOException {
        String doc = "<doc>A\uD800A</doc>";
        try {
            builder.build(doc, "http://www.example.com");   
            fail("Allowed malformed doc");
        }
        catch (ParsingException success) {
            assertNotNull(success.getMessage());
            assertEquals("http://www.example.com/", success.getURI());
        }
    }
public void testbuildmalformeddocumentwithunpairedsurrogate() throws ioexception { string doc = "<doc>a\ud800a</doc>"; try { builder.build(doc, "http://www.example.com"); fail("allowed malformed doc"); } catch (parsingexception success) { assertnotnull(success.getmessage()); assertequals("http://www.example.com/", success.geturi()); } }