### Question:
DefaultXDOMOfficeDocumentBuilder implements XDOMOfficeDocumentBuilder { @Override public XDOMOfficeDocument build(InputStream officeFileStream, String officeFileName, DocumentReference reference, boolean filterStyles) throws OfficeImporterException { XDOMOfficeDocument xdomOfficeDocument = build(this.xhtmlOfficeDocumentBuilder.build(officeFileStream, officeFileName, reference, filterStyles)); xdomOfficeDocument.getContentDocument().getMetaData() .addMetaData(MetaData.BASE, entityReferenceSerializer.serialize(reference)); return xdomOfficeDocument; }  @Override XDOMOfficeDocument build(InputStream officeFileStream, String officeFileName, DocumentReference reference,
        boolean filterStyles); @Override XDOMOfficeDocument build(XHTMLOfficeDocument xhtmlOfficeDocument);  }### Answer:
@Test public void xdomOfficeDocumentBuilding() throws Exception { final InputStream mockOfficeFileStream = new ByteArrayInputStream(new byte[1024]); final Map<String, InputStream> mockInput = new HashMap<String, InputStream>(); mockInput.put(INPUT_FILE_NAME, mockOfficeFileStream); final Map<String, byte[]> mockOutput = new HashMap<String, byte[]>(); mockOutput.put(OUTPUT_FILE_NAME, "<html><head><title></tile></head><body><p><strong>Hello There</strong></p></body></html>".getBytes()); final OfficeConverter mockDocumentConverter = mock(OfficeConverter.class); final DocumentReference documentReference = new DocumentReference("xwiki", "Main", "Test"); when(mockOfficeServer.getConverter()).thenReturn(mockDocumentConverter); when(mockDocumentConverter.convert(mockInput, INPUT_FILE_NAME, OUTPUT_FILE_NAME)).thenReturn(mockOutput); when(mockDocumentReferenceResolver.resolve("xwiki:Main.Test")).thenReturn(documentReference); when(mockDefaultStringEntityReferenceSerializer.serialize(documentReference)).thenReturn("xwiki:Main.Test"); XDOMOfficeDocument document = xdomOfficeDocumentBuilder.build(mockOfficeFileStream, INPUT_FILE_NAME, documentReference, true); assertEquals("xwiki:Main.Test", document.getContentDocument().getMetaData().getMetaData(MetaData.BASE)); assertEquals("**Hello There**", document.getContentAsString()); assertEquals(0, document.getArtifacts().size()); verify(mockOfficeServer).getConverter(); }