### Question:
DefaultOfficeViewerScriptService implements OfficeViewerScriptService { @Override public String view(AttachmentReference attachmentReference) { Map<String, String> parameters = Collections.emptyMap(); return view(attachmentReference, parameters); }  @Override Exception getCaughtException(); @Override String view(AttachmentReference attachmentReference); @Override String view(AttachmentReference attachmentReference, Map<String, String> parameters); @Override boolean isMimeTypeSupported(String mimeType);  }### Answer:
@Test public void view() throws Exception { Execution execution = mocker.getInstance(Execution.class); when(execution.getContext()).thenReturn(new ExecutionContext()); AttachmentReference attachmentReference = new AttachmentReference("file.odt", new DocumentReference("wiki", "Space", "Page")); DocumentModelBridge document = mock(DocumentModelBridge.class); DocumentAccessBridge documentAccessBridge = mocker.getInstance(DocumentAccessBridge.class); when(documentAccessBridge.isDocumentViewable(attachmentReference.getDocumentReference())).thenReturn(true); when(documentAccessBridge.getTranslatedDocumentInstance(attachmentReference.getDocumentReference())) .thenReturn(document); when(document.getSyntax()).thenReturn(Syntax.TEX_1_0); XDOM xdom = new XDOM(Collections.<Block> emptyList()); OfficeViewer viewer = mocker.getInstance(OfficeViewer.class); when(viewer.createView(attachmentReference, Collections.<String, String> emptyMap())).thenReturn(xdom); BlockRenderer xhtmlRenderer = mocker.registerMockComponent(BlockRenderer.class, "xhtml/1.0"); Assert.assertEquals("", mocker.getComponentUnderTest().view(attachmentReference)); TransformationManager transformationManager = mocker.getInstance(TransformationManager.class); verify(transformationManager).performTransformations(eq(xdom), notNull(TransformationContext.class)); verify(xhtmlRenderer).render(eq(xdom), notNull(WikiPrinter.class)); }