Search in sources :

Example 1 with MailTo

use of com.fsck.k9.helper.MailTo in project k-9 by k9mail.

the class MailToTest method testGetCc_singleEmailAddress.

@Test
public void testGetCc_singleEmailAddress() {
    Uri uri = Uri.parse("mailto:test1@abc.com?cc=test3@abc.com");
    MailTo mailToHelper = MailTo.parse(uri);
    Address[] emailAddressList = mailToHelper.getCc();
    assertEquals(emailAddressList[0].getAddress(), "test3@abc.com");
}
Also used : Address(com.fsck.k9.mail.Address) Uri(android.net.Uri) Test(org.junit.Test)

Example 2 with MailTo

use of com.fsck.k9.helper.MailTo in project k-9 by k9mail.

the class MailToTest method testGetTo_multipleEmailAddress.

@Test
public void testGetTo_multipleEmailAddress() {
    Uri uri = Uri.parse("mailto:test1@abc.com?to=test2@abc.com");
    MailTo mailToHelper = MailTo.parse(uri);
    Address[] emailAddressList = mailToHelper.getTo();
    assertEquals(emailAddressList[0].getAddress(), "test1@abc.com");
    assertEquals(emailAddressList[1].getAddress(), "test2@abc.com");
}
Also used : Address(com.fsck.k9.mail.Address) Uri(android.net.Uri) Test(org.junit.Test)

Example 3 with MailTo

use of com.fsck.k9.helper.MailTo in project k-9 by k9mail.

the class MailToTest method testGetBcc_multipleEmailAddress.

@Test
public void testGetBcc_multipleEmailAddress() {
    Uri uri = Uri.parse("mailto:?bcc=test3@abc.com&bcc=test4@abc.com");
    MailTo mailToHelper = MailTo.parse(uri);
    Address[] emailAddressList = mailToHelper.getBcc();
    assertEquals(emailAddressList[0].getAddress(), "test3@abc.com");
    assertEquals(emailAddressList[1].getAddress(), "test4@abc.com");
}
Also used : Address(com.fsck.k9.mail.Address) Uri(android.net.Uri) Test(org.junit.Test)

Example 4 with MailTo

use of com.fsck.k9.helper.MailTo in project k-9 by k9mail.

the class ListHeadersTest method getListPostAddresses_withMailTo_shouldReturnCorrectAddress.

@Test
public void getListPostAddresses_withMailTo_shouldReturnCorrectAddress() throws Exception {
    for (String emailAddress : TEST_EMAIL_ADDRESSES) {
        String headerValue = "<mailto:" + emailAddress + ">";
        Message message = buildMimeMessageWithListPostValue(headerValue);
        Address[] result = ListHeaders.getListPostAddresses(message);
        assertExtractedAddressMatchesEmail(emailAddress, result);
    }
}
Also used : Message(com.fsck.k9.mail.Message) Address(com.fsck.k9.mail.Address) Test(org.junit.Test)

Example 5 with MailTo

use of com.fsck.k9.helper.MailTo in project k-9 by k9mail.

the class ListHeadersTest method getListPostAddresses_withMailtoWithSubject_shouldReturnCorrectAddress.

@Test
public void getListPostAddresses_withMailtoWithSubject_shouldReturnCorrectAddress() throws Exception {
    for (String emailAddress : TEST_EMAIL_ADDRESSES) {
        String headerValue = "<mailto:" + emailAddress + "?subject=list%20posting>";
        Message message = buildMimeMessageWithListPostValue(headerValue);
        Address[] result = ListHeaders.getListPostAddresses(message);
        assertExtractedAddressMatchesEmail(emailAddress, result);
    }
}
Also used : Message(com.fsck.k9.mail.Message) Address(com.fsck.k9.mail.Address) Test(org.junit.Test)

Aggregations

Address (com.fsck.k9.mail.Address)9 Test (org.junit.Test)9 Uri (android.net.Uri)7 Message (com.fsck.k9.mail.Message)3 Parcelable (android.os.Parcelable)1 MailTo (com.fsck.k9.helper.MailTo)1