// Manually construct illegal XML and make sure the outputter notices
@Test
public void test_ErrorSurrogatePairOutput() throws JDOMException, IOException {
SAXBuilder builder = new SAXBuilder();
builder.setExpandEntities(true);
Document doc = builder.build(new StringReader("<?xml version=\"1.0\"?><root></root>"));
Text t = new UncheckedJDOMFactory().text("\uD800\uDBFF");
doc.getRootElement().setContent(t);
Format format = Format.getCompactFormat().setEncoding("ISO-8859-1");
XMLOutputter outputter = new XMLOutputter(format);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
outputter.output(doc, baos);