@AllureFeatures.Attachments @Test void shouldRenderRequestAttachment() { final HttpRequestAttachment data = randomHttpRequestAttachment(); final DefaultAttachmentContent content = new FreemarkerAttachmentRenderer("http-request.ftl") .render(data); assertThat(content) .hasFieldOrPropertyWithValue("contentType", "text/html") .hasFieldOrPropertyWithValue("fileExtension", ".html") .hasFieldOrProperty("content"); }
@Override public DefaultAttachmentContent render(final AttachmentData data) { try (Writer writer = new StringWriter()) { final Template template = configuration.getTemplate(templateName); template.process(Collections.singletonMap("data", data), writer); return new DefaultAttachmentContent(writer.toString(), "text/html", ".html"); } catch (Exception e) { throw new AttachmentRenderException("Could't render http attachment file", e); } }
FreemarkerAttachmentRenderer implements AttachmentRenderer<AttachmentData> { @Override public DefaultAttachmentContent render(final AttachmentData data) { try (Writer writer = new StringWriter()) { final Template template = configuration.getTemplate(templateName); template.process(Collections.singletonMap("data", data), writer); return new DefaultAttachmentContent(writer.toString(), "text/html", ".html"); } catch (Exception e) { throw new AttachmentRenderException("Could't render http attachment file", e); } } }
FreemarkerAttachmentRenderer implements AttachmentRenderer<AttachmentData> { @Override public DefaultAttachmentContent render(final AttachmentData data) { try (Writer writer = new StringWriter()) { final Template template = configuration.getTemplate(templateName); template.process(Collections.singletonMap("data", data), writer); return new DefaultAttachmentContent(writer.toString(), "text/html", ".html"); } catch (Exception e) { throw new AttachmentRenderException("Could't render http attachment file", e); } } FreemarkerAttachmentRenderer(final String templateName); }
FreemarkerAttachmentRenderer implements AttachmentRenderer<AttachmentData> { @Override public DefaultAttachmentContent render(final AttachmentData data) { try (Writer writer = new StringWriter()) { final Template template = configuration.getTemplate(templateName); template.process(Collections.singletonMap("data", data), writer); return new DefaultAttachmentContent(writer.toString(), "text/html", ".html"); } catch (Exception e) { throw new AttachmentRenderException("Could't render http attachment file", e); } } FreemarkerAttachmentRenderer(final String templateName); @Override DefaultAttachmentContent render(final AttachmentData data); }
FreemarkerAttachmentRenderer implements AttachmentRenderer<AttachmentData> { @Override public DefaultAttachmentContent render(final AttachmentData data) { try (Writer writer = new StringWriter()) { final Template template = configuration.getTemplate(templateName); template.process(Collections.singletonMap("data", data), writer); return new DefaultAttachmentContent(writer.toString(), "text/html", ".html"); } catch (Exception e) { throw new AttachmentRenderException("Could't render http attachment file", e); } } FreemarkerAttachmentRenderer(final String templateName); @Override DefaultAttachmentContent render(final AttachmentData data);  }