예제 #1
0
  @Test
  public void existsInContacts() throws Exception {
    Mailbox mbox =
        MailboxManager.getInstance().getMailboxByAccountId(MockProvisioning.DEFAULT_ACCOUNT_ID);
    mbox.createContact(
        null,
        new ParsedContact(Collections.singletonMap(ContactConstants.A_email, "*****@*****.**")),
        Mailbox.ID_FOLDER_CONTACTS,
        null);
    MailboxTestUtil.index(mbox);

    Assert.assertTrue(
        mbox.index.existsInContacts(
            ImmutableList.of(
                new InternetAddress("Test <*****@*****.**>"),
                new InternetAddress("Test <*****@*****.**>"))));
    Assert.assertFalse(
        mbox.index.existsInContacts(
            ImmutableList.of(
                new InternetAddress("Test <*****@*****.**>"),
                new InternetAddress("Test <*****@*****.**>"))));
  }