@Test void fromMessageResultsShouldReturnCorrectView() throws Exception { MessageHeaderView actual = testee.fromMessageIds(ImmutableList.of(message1.getMessageId()), session).collectList().block().get(0); SoftAssertions.assertSoftly(softly -> { softly.assertThat(actual.getId()).isEqualTo(message1.getMessageId()); softly.assertThat(actual.getMailboxIds()).containsExactly(bobInbox.getId()); softly.assertThat(actual.getThreadId()).isEqualTo(message1.getMessageId().serialize()); softly.assertThat(actual.getSize()).isEqualTo(Number.fromLong(2255)); softly.assertThat(actual.getKeywords()).isEqualTo(Keywords.strictFactory().from(Keyword.SEEN).asMap()); softly.assertThat(actual.getBlobId()).isEqualTo(BlobId.of(message1.getMessageId().serialize())); softly.assertThat(actual.getInReplyToMessageId()).isEqualTo(Optional.of(BOB.asString())); softly.assertThat(actual.getHeaders()).isEqualTo(HEADERS_MAP); softly.assertThat(actual.getFrom()).isEqualTo(Optional.of(ALICE_EMAIL)); softly.assertThat(actual.getTo()).isEqualTo(ImmutableList.of(BOB_EMAIL)); softly.assertThat(actual.getCc()).isEqualTo(ImmutableList.of(JACK_EMAIL, JACOB_EMAIL)); softly.assertThat(actual.getBcc()).isEqualTo(ImmutableList.of(ALICE_EMAIL)); softly.assertThat(actual.getReplyTo()).isEqualTo(ImmutableList.of(ALICE_EMAIL)); softly.assertThat(actual.getSubject()).isEqualTo("Full message"); softly.assertThat(actual.getDate()).isEqualTo("2016-06-07T14:23:37Z"); }); }
@Override public Flux<MessageHeaderView> fromMessageIds(List<MessageId> messageIds, MailboxSession mailboxSession) { Flux<MessageResult> messages = Flux.from(messageIdManager.getMessagesReactive(messageIds, FetchGroup.HEADERS, mailboxSession)); return Helpers.toMessageViews(messages, this::fromMessageResults); }
MessageHeaderViewFactory implements MessageViewFactory<MessageHeaderView> { @Override public Flux<MessageHeaderView> fromMessageIds(List<MessageId> messageIds, MailboxSession mailboxSession) { Flux<MessageResult> messages = Flux.from(messageIdManager.getMessagesReactive(messageIds, FetchGroup.HEADERS, mailboxSession)); return Helpers.toMessageViews(messages, this::fromMessageResults); } }
MessageHeaderViewFactory implements MessageViewFactory<MessageHeaderView> { @Override public Flux<MessageHeaderView> fromMessageIds(List<MessageId> messageIds, MailboxSession mailboxSession) { Flux<MessageResult> messages = Flux.from(messageIdManager.getMessagesReactive(messageIds, FetchGroup.HEADERS, mailboxSession)); return Helpers.toMessageViews(messages, this::fromMessageResults); } @Inject @VisibleForTesting  MessageHeaderViewFactory(BlobManager blobManager, MessageIdManager messageIdManager); }
MessageHeaderViewFactory implements MessageViewFactory<MessageHeaderView> { @Override public Flux<MessageHeaderView> fromMessageIds(List<MessageId> messageIds, MailboxSession mailboxSession) { Flux<MessageResult> messages = Flux.from(messageIdManager.getMessagesReactive(messageIds, FetchGroup.HEADERS, mailboxSession)); return Helpers.toMessageViews(messages, this::fromMessageResults); } @Inject @VisibleForTesting  MessageHeaderViewFactory(BlobManager blobManager, MessageIdManager messageIdManager); @Override Flux<MessageHeaderView> fromMessageIds(List<MessageId> messageIds, MailboxSession mailboxSession); }
MessageHeaderViewFactory implements MessageViewFactory<MessageHeaderView> { @Override public Flux<MessageHeaderView> fromMessageIds(List<MessageId> messageIds, MailboxSession mailboxSession) { Flux<MessageResult> messages = Flux.from(messageIdManager.getMessagesReactive(messageIds, FetchGroup.HEADERS, mailboxSession)); return Helpers.toMessageViews(messages, this::fromMessageResults); } @Inject @VisibleForTesting  MessageHeaderViewFactory(BlobManager blobManager, MessageIdManager messageIdManager); @Override Flux<MessageHeaderView> fromMessageIds(List<MessageId> messageIds, MailboxSession mailboxSession);  }