@Test public void shouldSendMessageWithBasicFields() { MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); headers.add("test", "example1"); headers.add("test", "example2"); MailMessage message = new SimpleMailMessage() .setFrom("from@example.com") .addTo("to@example.com") .addCc("cc@example.com") .addBcc("bcc@example.com") .setBounceAddress("bounce@example.com") .setSubject("Test subject") .setText("Test text") .setHtml("Test html") .setHeaders(headers); 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);  }