@Test public void assertIsUserOwnerOfMailboxesShouldNotThrowWhenUserIsTheOwnerOfTheMailbox() throws Exception { InMemoryId mailboxId = InMemoryId.of(6789); MessageManager mailbox = mock(MessageManager.class); when(mockedMailboxManager.getMailbox(mailboxId, session)) .thenReturn(mailbox); when(mockedMailboxIdFactory.fromString(mailboxId.serialize())) .thenReturn(mailboxId); when(mailbox.getMailboxPath()) .thenReturn(MailboxPath.forUser(USER, mailboxId.serialize())); sut.assertIsUserOwnerOfMailboxes(ImmutableList.of(mailboxId), session); }
@VisibleForTesting void assertIsUserOwnerOfMailboxes(List<MailboxId> mailboxIds, MailboxSession session) throws MailboxNotOwnedException { if (!allMailboxOwned(mailboxIds, session)) { throw new MailboxNotOwnedException(); } }
SetMessagesCreationProcessor implements SetMessagesProcessor { @VisibleForTesting void assertIsUserOwnerOfMailboxes(List<MailboxId> mailboxIds, MailboxSession session) throws MailboxNotOwnedException { if (!allMailboxOwned(mailboxIds, session)) { throw new MailboxNotOwnedException(); } } }
SetMessagesCreationProcessor implements SetMessagesProcessor { @VisibleForTesting void assertIsUserOwnerOfMailboxes(List<MailboxId> mailboxIds, MailboxSession session) throws MailboxNotOwnedException { if (!allMailboxOwned(mailboxIds, session)) { throw new MailboxNotOwnedException(); } } @VisibleForTesting @Inject  SetMessagesCreationProcessor(MessageFullViewFactory messageFullViewFactory,
                                 SystemMailboxesProvider systemMailboxesProvider,
                                 AttachmentChecker attachmentChecker,
                                 MetricFactory metricFactory,
                                 MailboxManager mailboxManager,
                                 MailboxId.Factory mailboxIdFactory,
                                 MessageAppender messageAppender,
                                 MessageSender messageSender,
                                 ReferenceUpdater referenceUpdater,
                                 CanSendFrom canSendFrom); }
SetMessagesCreationProcessor implements SetMessagesProcessor { @VisibleForTesting void assertIsUserOwnerOfMailboxes(List<MailboxId> mailboxIds, MailboxSession session) throws MailboxNotOwnedException { if (!allMailboxOwned(mailboxIds, session)) { throw new MailboxNotOwnedException(); } } @VisibleForTesting @Inject  SetMessagesCreationProcessor(MessageFullViewFactory messageFullViewFactory,
                                 SystemMailboxesProvider systemMailboxesProvider,
                                 AttachmentChecker attachmentChecker,
                                 MetricFactory metricFactory,
                                 MailboxManager mailboxManager,
                                 MailboxId.Factory mailboxIdFactory,
                                 MessageAppender messageAppender,
                                 MessageSender messageSender,
                                 ReferenceUpdater referenceUpdater,
                                 CanSendFrom canSendFrom); @Override SetMessagesResponse process(SetMessagesRequest request, MailboxSession mailboxSession); }
SetMessagesCreationProcessor implements SetMessagesProcessor { @VisibleForTesting void assertIsUserOwnerOfMailboxes(List<MailboxId> mailboxIds, MailboxSession session) throws MailboxNotOwnedException { if (!allMailboxOwned(mailboxIds, session)) { throw new MailboxNotOwnedException(); } } @VisibleForTesting @Inject  SetMessagesCreationProcessor(MessageFullViewFactory messageFullViewFactory,
                                 SystemMailboxesProvider systemMailboxesProvider,
                                 AttachmentChecker attachmentChecker,
                                 MetricFactory metricFactory,
                                 MailboxManager mailboxManager,
                                 MailboxId.Factory mailboxIdFactory,
                                 MessageAppender messageAppender,
                                 MessageSender messageSender,
                                 ReferenceUpdater referenceUpdater,
                                 CanSendFrom canSendFrom); @Override SetMessagesResponse process(SetMessagesRequest request, MailboxSession mailboxSession);  }