@Test public void toHTMLWithOfficeViewer() throws Exception { OfficeMacroImporter officeMacroImporter = this.mocker.getInstance(OfficeMacroImporter.class); XDOM xdom = mock(XDOM.class); when(officeMacroImporter.buildXDOM(attachmentReference, false)).thenReturn(xdom); when(officeMacroImporter.render(xdom)).thenReturn("foo"); Map<String, Object> parameters = Collections.singletonMap("useOfficeViewer", "true"); assertEquals("foo", this.mocker.getComponentUnderTest().toHTML(attachmentReference, parameters)); }
@Override public String toHTML(AttachmentReference attachmentReference, Map<String, Object> parameters) throws Exception { boolean filterStyles = Boolean.valueOf(String.valueOf(parameters.get("filterStyles"))); if (Boolean.valueOf(String.valueOf(parameters.get("useOfficeViewer")))) { return this.officeMacroImporter .render(this.officeMacroImporter.buildXDOM(attachmentReference, filterStyles)); } else { return maybeConvertAttachmentContent(attachmentReference, filterStyles); } }
OfficeAttachmentImporter implements AttachmentImporter { @Override public String toHTML(AttachmentReference attachmentReference, Map<String, Object> parameters) throws Exception { boolean filterStyles = Boolean.valueOf(String.valueOf(parameters.get("filterStyles"))); if (Boolean.valueOf(String.valueOf(parameters.get("useOfficeViewer")))) { return this.officeMacroImporter .render(this.officeMacroImporter.buildXDOM(attachmentReference, filterStyles)); } else { return maybeConvertAttachmentContent(attachmentReference, filterStyles); } } }
OfficeAttachmentImporter implements AttachmentImporter { @Override public String toHTML(AttachmentReference attachmentReference, Map<String, Object> parameters) throws Exception { boolean filterStyles = Boolean.valueOf(String.valueOf(parameters.get("filterStyles"))); if (Boolean.valueOf(String.valueOf(parameters.get("useOfficeViewer")))) { return this.officeMacroImporter .render(this.officeMacroImporter.buildXDOM(attachmentReference, filterStyles)); } else { return maybeConvertAttachmentContent(attachmentReference, filterStyles); } }  }
OfficeAttachmentImporter implements AttachmentImporter { @Override public String toHTML(AttachmentReference attachmentReference, Map<String, Object> parameters) throws Exception { boolean filterStyles = Boolean.valueOf(String.valueOf(parameters.get("filterStyles"))); if (Boolean.valueOf(String.valueOf(parameters.get("useOfficeViewer")))) { return this.officeMacroImporter .render(this.officeMacroImporter.buildXDOM(attachmentReference, filterStyles)); } else { return maybeConvertAttachmentContent(attachmentReference, filterStyles); } }  @Override String toHTML(AttachmentReference attachmentReference, Map<String, Object> parameters); }
OfficeAttachmentImporter implements AttachmentImporter { @Override public String toHTML(AttachmentReference attachmentReference, Map<String, Object> parameters) throws Exception { boolean filterStyles = Boolean.valueOf(String.valueOf(parameters.get("filterStyles"))); if (Boolean.valueOf(String.valueOf(parameters.get("useOfficeViewer")))) { return this.officeMacroImporter .render(this.officeMacroImporter.buildXDOM(attachmentReference, filterStyles)); } else { return maybeConvertAttachmentContent(attachmentReference, filterStyles); } }  @Override String toHTML(AttachmentReference attachmentReference, Map<String, Object> parameters);  }