@SuppressWarnings("unchecked") @AllureFeatures.Attachments @Test void shouldProcessAttachments() { final HttpRequestAttachment attachment = randomHttpRequestAttachment(); final AllureLifecycle lifecycle = mock(AllureLifecycle.class); final AttachmentRenderer<AttachmentData> renderer = mock(AttachmentRenderer.class); final AttachmentContent content = randomAttachmentContent(); doReturn(content) .when(renderer) .render(attachment); new DefaultAttachmentProcessor(lifecycle) .addAttachment(attachment, renderer); verify(renderer, times(1)).render(attachment); verify(lifecycle, times(1)) .addAttachment( eq(attachment.getName()), eq(content.getContentType()), eq(content.getFileExtension()), eq(content.getContent().getBytes(StandardCharsets.UTF_8)) ); }
@Override public void addAttachment(final AttachmentData attachmentData, final AttachmentRenderer<AttachmentData> renderer) { final AttachmentContent content = renderer.render(attachmentData); lifecycle.addAttachment( attachmentData.getName(), content.getContentType(), content.getFileExtension(), content.getContent().getBytes(StandardCharsets.UTF_8) ); }
DefaultAttachmentProcessor implements AttachmentProcessor<AttachmentData> { @Override public void addAttachment(final AttachmentData attachmentData, final AttachmentRenderer<AttachmentData> renderer) { final AttachmentContent content = renderer.render(attachmentData); lifecycle.addAttachment( attachmentData.getName(), content.getContentType(), content.getFileExtension(), content.getContent().getBytes(StandardCharsets.UTF_8) ); } }
DefaultAttachmentProcessor implements AttachmentProcessor<AttachmentData> { @Override public void addAttachment(final AttachmentData attachmentData, final AttachmentRenderer<AttachmentData> renderer) { final AttachmentContent content = renderer.render(attachmentData); lifecycle.addAttachment( attachmentData.getName(), content.getContentType(), content.getFileExtension(), content.getContent().getBytes(StandardCharsets.UTF_8) ); } DefaultAttachmentProcessor();  DefaultAttachmentProcessor(final AllureLifecycle lifecycle); }
DefaultAttachmentProcessor implements AttachmentProcessor<AttachmentData> { @Override public void addAttachment(final AttachmentData attachmentData, final AttachmentRenderer<AttachmentData> renderer) { final AttachmentContent content = renderer.render(attachmentData); lifecycle.addAttachment( attachmentData.getName(), content.getContentType(), content.getFileExtension(), content.getContent().getBytes(StandardCharsets.UTF_8) ); } DefaultAttachmentProcessor();  DefaultAttachmentProcessor(final AllureLifecycle lifecycle); @Override void addAttachment(final AttachmentData attachmentData,
                              final AttachmentRenderer<AttachmentData> renderer); }
DefaultAttachmentProcessor implements AttachmentProcessor<AttachmentData> { @Override public void addAttachment(final AttachmentData attachmentData, final AttachmentRenderer<AttachmentData> renderer) { final AttachmentContent content = renderer.render(attachmentData); lifecycle.addAttachment( attachmentData.getName(), content.getContentType(), content.getFileExtension(), content.getContent().getBytes(StandardCharsets.UTF_8) ); } DefaultAttachmentProcessor();  DefaultAttachmentProcessor(final AllureLifecycle lifecycle); @Override void addAttachment(final AttachmentData attachmentData,
                              final AttachmentRenderer<AttachmentData> renderer);  }