@Test public void toHTMLAttachmentNotFound() throws Exception { when(this.authorization.hasAccess(Right.EDIT, attachmentReference)).thenReturn(true); try { this.mocker.getComponentUnderTest().toHTML(attachmentReference, Collections.emptyMap()); fail(); } catch (RuntimeException expected) { assertEquals("Attachment not found: [Some.Page@my.doc].", expected.getMessage()); } }
@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);  }