use of com.zimbra.common.mailbox.ItemIdentifier in project zm-mailbox by Zimbra.
the class TestRemoteImapMailboxStore method testOpenImapFolder.
@Test
public void testOpenImapFolder() throws Exception {
Mailbox mbox = TestUtil.getMailbox(USER_NAME);
Folder folder = mbox.createFolder(null, "TestOpenImapFolder", new Folder.FolderOptions().setDefaultView(MailItem.Type.MESSAGE));
int folderId = folder.getId();
List<ImapMessage> expected = new LinkedList<ImapMessage>();
for (int i = 1; i <= 3; i++) {
Message msg = TestUtil.addMessage(mbox, folderId, String.format("imap message %s", i), System.currentTimeMillis());
expected.add(new ImapMessage(msg));
}
ZMailbox zmbox = TestUtil.getZMailbox(USER_NAME);
RemoteImapMailboxStore remoteStore = new RemoteImapMailboxStore(zmbox, TestUtil.getAccount(USER_NAME).getId());
List<ImapMessage> actual = remoteStore.openImapFolder(null, new ItemIdentifier(mbox.getAccountId(), folderId));
Collections.sort(expected);
Collections.sort(actual);
assertEquals("expected and actual ImapMessage lists have different lengths", expected.size(), actual.size());
for (int i = 0; i < expected.size(); i++) {
assertEquals(expected.get(i), actual.get(i));
}
}
Aggregations