@Test public void shouldSendMessageWithAttachments() throws IOException { MailAttachment bufferAttachment = getAttachmentTemplate() .setData(Flux.just(getDataBuffer("Test buffer content 1"), getDataBuffer("Test buffer content 2"))); MailAttachment fileAttachment = getAttachmentTemplate() .setFile(getFile("Test file content 1")); MailAttachment inlineBufferAttachment = getAttachmentTemplate() .setData(Flux.just(getDataBuffer("Test buffer content 3"), getDataBuffer("Test buffer content 4"))); MailAttachment inlineFileAttachment = getAttachmentTemplate() .setFile(getFile("Test file content 2")); MailMessage message = new SimpleMailMessage() .addAttachment(bufferAttachment) .addAttachment(fileAttachment) .addInlineAttachment(inlineBufferAttachment) .addInlineAttachment(inlineFileAttachment); MailResult result = mailClient.send(message) .blockOptional() .orElseThrow(RuntimeException::new); assertThat(result.getMessageId()).isEqualTo("1"); assertThat(result.getRecipients()).containsOnly("to@example.com", "cc@example.com", "bcc@example.com"); ArgumentCaptor<io.vertx.ext.mail.MailMessage> vertxMessageCaptor = ArgumentCaptor.forClass(io.vertx.ext.mail.MailMessage.class); verify(mockMutinyMailClient).sendMail(vertxMessageCaptor.capture()); assertMessage(message, vertxMessageCaptor.getValue()); }
@Override public Mono<MailResult> send(MailMessage message) { return mailMessageConverter .toVertxMailMessage(message) .flatMap(vertxMessage -> delegate.sendMail(vertxMessage) .convert() .with(UniReactorConverters.toMono())) .map(mailResultConverter::fromVertxMailResult); }
VertxMailClient implements MailClient { @Override public Mono<MailResult> send(MailMessage message) { return mailMessageConverter .toVertxMailMessage(message) .flatMap(vertxMessage -> delegate.sendMail(vertxMessage) .convert() .with(UniReactorConverters.toMono())) .map(mailResultConverter::fromVertxMailResult); } }
VertxMailClient implements MailClient { @Override public Mono<MailResult> send(MailMessage message) { return mailMessageConverter .toVertxMailMessage(message) .flatMap(vertxMessage -> delegate.sendMail(vertxMessage) .convert() .with(UniReactorConverters.toMono())) .map(mailResultConverter::fromVertxMailResult); } VertxMailClient(io.vertx.mutiny.ext.mail.MailClient delegate, MailMessageConverter mailMessageConverter,
        MailResultConverter mailResultConverter); }
VertxMailClient implements MailClient { @Override public Mono<MailResult> send(MailMessage message) { return mailMessageConverter .toVertxMailMessage(message) .flatMap(vertxMessage -> delegate.sendMail(vertxMessage) .convert() .with(UniReactorConverters.toMono())) .map(mailResultConverter::fromVertxMailResult); } VertxMailClient(io.vertx.mutiny.ext.mail.MailClient delegate, MailMessageConverter mailMessageConverter,
        MailResultConverter mailResultConverter); @Override Mono<MailResult> send(MailMessage message); }
VertxMailClient implements MailClient { @Override public Mono<MailResult> send(MailMessage message) { return mailMessageConverter .toVertxMailMessage(message) .flatMap(vertxMessage -> delegate.sendMail(vertxMessage) .convert() .with(UniReactorConverters.toMono())) .map(mailResultConverter::fromVertxMailResult); } VertxMailClient(io.vertx.mutiny.ext.mail.MailClient delegate, MailMessageConverter mailMessageConverter,
        MailResultConverter mailResultConverter); @Override Mono<MailResult> send(MailMessage message);  }