@Test
@Ignore("No contract to call endDocument() in case of an Exception")
public void testX32ContentHandlerAsWriterError() throws Exception {

	
	CloseObservableWriter cow = new CloseObservableWriter() {
		@Override
		public void write(char[] arg0, int arg1, int arg2) {
			throw new RuntimeException("fakeFailure");
		}
		
	};
	Result result = new StreamResult(cow);
	SAXTransformerFactory tf = (SAXTransformerFactory) TransformerFactory.newInstance();
	TransformerHandler transformerHandler = tf.newTransformerHandler();
	transformerHandler.setResult(result);
	try (MessageOutputStream stream = new MessageOutputStream(null, transformerHandler, (IForwardTarget)null, null, null)) {
	
		try {
			try (Writer writer = stream.asWriter()) {
				writer.write(testString);
			}
			fail("exception should be thrown");
		} catch (Exception e) {
			assertThat(e.getMessage(),StringContains.containsString("fakeFailure"));
		}
		
	}
	assertTrue(cow.isCloseCalled());
}