@Test void fromMessageResultsShouldCombineKeywords() throws Exception { messageIdManager.setInMailboxes(message1.getMessageId(), ImmutableList.of(bobInbox.getId(), bobMailbox.getId()), session); bobMailbox.setFlags(new Flags(Flags.Flag.FLAGGED), MessageManager.FlagsUpdateMode.REPLACE, MessageRange.all(), session); MessageMetadataView 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.getKeywords()).isEqualTo(Keywords.strictFactory().from(Keyword.SEEN, Keyword.FLAGGED).asMap()); }); }
@Override public Flux<MessageMetadataView> fromMessageIds(List<MessageId> messageIds, MailboxSession session) { Flux<MessageResult> messages = Flux.from(messageIdManager.getMessagesReactive(messageIds, FetchGroup.MINIMAL, session)); return Helpers.toMessageViews(messages, this::fromMessageResults); }
MessageMetadataViewFactory implements MessageViewFactory<MessageMetadataView> { @Override public Flux<MessageMetadataView> fromMessageIds(List<MessageId> messageIds, MailboxSession session) { Flux<MessageResult> messages = Flux.from(messageIdManager.getMessagesReactive(messageIds, FetchGroup.MINIMAL, session)); return Helpers.toMessageViews(messages, this::fromMessageResults); } }
MessageMetadataViewFactory implements MessageViewFactory<MessageMetadataView> { @Override public Flux<MessageMetadataView> fromMessageIds(List<MessageId> messageIds, MailboxSession session) { Flux<MessageResult> messages = Flux.from(messageIdManager.getMessagesReactive(messageIds, FetchGroup.MINIMAL, session)); return Helpers.toMessageViews(messages, this::fromMessageResults); } @Inject @VisibleForTesting  MessageMetadataViewFactory(BlobManager blobManager, MessageIdManager messageIdManager); }
MessageMetadataViewFactory implements MessageViewFactory<MessageMetadataView> { @Override public Flux<MessageMetadataView> fromMessageIds(List<MessageId> messageIds, MailboxSession session) { Flux<MessageResult> messages = Flux.from(messageIdManager.getMessagesReactive(messageIds, FetchGroup.MINIMAL, session)); return Helpers.toMessageViews(messages, this::fromMessageResults); } @Inject @VisibleForTesting  MessageMetadataViewFactory(BlobManager blobManager, MessageIdManager messageIdManager); @Override Flux<MessageMetadataView> fromMessageIds(List<MessageId> messageIds, MailboxSession session); @VisibleForTesting Mono<MessageMetadataView> fromMessageResults(Collection<MessageResult> messageResults); }
MessageMetadataViewFactory implements MessageViewFactory<MessageMetadataView> { @Override public Flux<MessageMetadataView> fromMessageIds(List<MessageId> messageIds, MailboxSession session) { Flux<MessageResult> messages = Flux.from(messageIdManager.getMessagesReactive(messageIds, FetchGroup.MINIMAL, session)); return Helpers.toMessageViews(messages, this::fromMessageResults); } @Inject @VisibleForTesting  MessageMetadataViewFactory(BlobManager blobManager, MessageIdManager messageIdManager); @Override Flux<MessageMetadataView> fromMessageIds(List<MessageId> messageIds, MailboxSession session); @VisibleForTesting Mono<MessageMetadataView> fromMessageResults(Collection<MessageResult> messageResults);  }