@Test(expected = IOException.class)
public void throwsIoExceptionWhenTransformationFails() throws Exception {

    doThrow(TransformerException.class).when(transformer).transform(same(source), isA(StreamResult.class));
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    xsltStreamingOutput.write(out);
}