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

    when(templates.newTransformer()).thenThrow(new TransformerConfigurationException());
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    xsltStreamingOutput.write(out);
}