@Test(expectedExceptions = DocumentBuilderException.class)
public final void testBuildDocumentShouldThrowExceptionWhenParsingFails() throws Exception {

    //GIVEN
    given(documentBuilderFactoryBuilder.buildDocumentBuilderFactory()).willReturn(documentBuilderFactory);
    given(documentBuilderFactory.newDocumentBuilder()).willReturn(documentBuilder);
    given(documentBuilder.parse(inputStream)).willThrow(new SAXException());
    //WHEN
    underTest.buildDocument(inputStream, null);
    //THEN exception thrown
}