@Test
public final void testBuildDocumentShouldParseInputStreamToDocument() throws Exception {

    //GIVEN
    given(documentBuilderFactoryBuilder.buildDocumentBuilderFactory()).willReturn(documentBuilderFactory);
    given(documentBuilderFactory.newDocumentBuilder()).willReturn(documentBuilder);
    given(documentBuilder.parse(inputStream)).willReturn(document);
    //WHEN
    Document actual = underTest.buildDocument(inputStream, null);
    //THEN
    verify(documentBuilderFactory).setNamespaceAware(true);
    verify(documentBuilder).parse(inputStream);
    assertEquals(actual, document);
}