@Test public void mailboxFromMetaDataShouldReturnPresentStoredValue() throws Exception { String name = "myBox"; MailboxPath mailboxPath = MailboxPath.forUser(user, name); mailboxManager.createMailbox(mailboxPath, mailboxSession); mailboxManager.setRights(mailboxPath, MailboxACL.EMPTY.apply(MailboxACL.command() .forUser(OTHER_USER) .rights(MailboxACL.Right.Lookup, MailboxACL.Right.Read) .asAddition()), mailboxSession); MailboxMetaData metaData = mailboxManager.search(MailboxQuery.privateMailboxesBuilder(mailboxSession).build(), mailboxSession) .toStream() .filter(metadata -> metadata.getPath().equals(mailboxPath)) .findFirst() .get(); Optional<Mailbox> mailbox = sut.builder() .mailboxMetadata(metaData) .session(mailboxSession) .build(); softly.assertThat(mailbox).isPresent(); softly.assertThat(mailbox).map(Mailbox::getId).contains(metaData.getId()); softly.assertThat(mailbox).map(Mailbox::getName).contains(name); softly.assertThat(mailbox).map(Mailbox::getTotalMessages).contains(Number.ZERO); softly.assertThat(mailbox).map(Mailbox::getUnreadMessages).contains(Number.ZERO); softly.assertThat(mailbox).map(Mailbox::getSharedWith).contains(new Rights(ImmutableMap.of( OTHER_USER, ImmutableList.of(Rights.Right.Lookup, Rights.Right.Read)))); }
public MailboxBuilder builder() { QuotaLoader defaultQuotaLoader = new DefaultQuotaLoader(quotaRootResolver, quotaManager); return new MailboxBuilder(this, defaultQuotaLoader); }
MailboxFactory { public MailboxBuilder builder() { QuotaLoader defaultQuotaLoader = new DefaultQuotaLoader(quotaRootResolver, quotaManager); return new MailboxBuilder(this, defaultQuotaLoader); } }
MailboxFactory { public MailboxBuilder builder() { QuotaLoader defaultQuotaLoader = new DefaultQuotaLoader(quotaRootResolver, quotaManager); return new MailboxBuilder(this, defaultQuotaLoader); } @Inject  MailboxFactory(MailboxManager mailboxManager, QuotaManager quotaManager, QuotaRootResolver quotaRootResolver); }
MailboxFactory { public MailboxBuilder builder() { QuotaLoader defaultQuotaLoader = new DefaultQuotaLoader(quotaRootResolver, quotaManager); return new MailboxBuilder(this, defaultQuotaLoader); } @Inject  MailboxFactory(MailboxManager mailboxManager, QuotaManager quotaManager, QuotaRootResolver quotaRootResolver); MailboxBuilder builder(); }
MailboxFactory { public MailboxBuilder builder() { QuotaLoader defaultQuotaLoader = new DefaultQuotaLoader(quotaRootResolver, quotaManager); return new MailboxBuilder(this, defaultQuotaLoader); } @Inject  MailboxFactory(MailboxManager mailboxManager, QuotaManager quotaManager, QuotaRootResolver quotaRootResolver); MailboxBuilder builder();  }