Ejemplo n.º 1
0
  @Test
  public void createAutoContact() throws Exception {
    Mailbox mbox =
        MailboxManager.getInstance().getMailboxByAccountId(MockProvisioning.DEFAULT_ACCOUNT_ID);
    List<Contact> contacts =
        mbox.createAutoContact(
            null,
            ImmutableList.of(
                new InternetAddress("Test 1", "*****@*****.**"),
                new InternetAddress("Test 2", "*****@*****.**")));

    Assert.assertEquals(2, contacts.size());
    Assert.assertEquals("1, Test", contacts.get(0).getFileAsString());
    Assert.assertEquals(
        "*****@*****.**", contacts.get(0).getFields().get(ContactConstants.A_email));
    Assert.assertEquals("2, Test", contacts.get(1).getFileAsString());
    Assert.assertEquals(
        "*****@*****.**", contacts.get(1).getFields().get(ContactConstants.A_email));

    Collection<javax.mail.Address> newAddrs =
        mbox.newContactAddrs(
            ImmutableList.of(
                (javax.mail.Address)
                    new javax.mail.internet.InternetAddress("*****@*****.**", "Test 1"),
                (javax.mail.Address)
                    new javax.mail.internet.InternetAddress("*****@*****.**", "Test 2")));

    Assert.assertEquals(0, newAddrs.size());
  }