Search in sources :

Example 66 with Address

use of com.fsck.k9.mail.Address in project k-9 by k9mail.

the class MessageHelperTest method testToFriendlyWithChangeContactColor.

@Test
public void testToFriendlyWithChangeContactColor() throws Exception {
    Address address = new Address("test@testor.com");
    CharSequence friendly = MessageHelper.toFriendly(address, contactsWithFakeContact, true, true, Color.RED);
    assertTrue(friendly instanceof SpannableString);
    assertEquals("Tim Testor", friendly.toString());
}
Also used : SpannableString(android.text.SpannableString) Address(com.fsck.k9.mail.Address) RobolectricTest(com.fsck.k9.RobolectricTest) Test(org.junit.Test)

Example 67 with Address

use of com.fsck.k9.mail.Address in project k-9 by k9mail.

the class MessageHelperTest method testToFriendlyArray.

@Test
public void testToFriendlyArray() throws Exception {
    Address address1 = new Address("test@testor.com", "Tim Testor");
    Address address2 = new Address("foo@bar.com", "Foo Bar");
    Address[] addresses = new Address[] { address1, address2 };
    assertEquals("Tim Testor,Foo Bar", MessageHelper.toFriendly(addresses, contacts).toString());
}
Also used : Address(com.fsck.k9.mail.Address) RobolectricTest(com.fsck.k9.RobolectricTest) Test(org.junit.Test)

Example 68 with Address

use of com.fsck.k9.mail.Address in project k-9 by k9mail.

the class MessageHelperTest method testToFriendlyWithoutCorrespondentNames.

@Test
public void testToFriendlyWithoutCorrespondentNames() throws Exception {
    Address address = new Address("test@testor.com", "Tim Testor");
    CharSequence friendly = MessageHelper.toFriendly(address, contactsWithFakeContact, false, false, 0);
    assertEquals("test@testor.com", friendly.toString());
}
Also used : Address(com.fsck.k9.mail.Address) RobolectricTest(com.fsck.k9.RobolectricTest) Test(org.junit.Test)

Example 69 with Address

use of com.fsck.k9.mail.Address in project k-9 by k9mail.

the class MessageHelperTest method toFriendly_spoofPreventionOverridesPersonal.

@Test
public void toFriendly_spoofPreventionOverridesPersonal() {
    Address address = new Address("test@testor.com", "potus@whitehouse.gov");
    CharSequence friendly = MessageHelper.toFriendly(address, contacts);
    assertEquals("test@testor.com", friendly.toString());
}
Also used : Address(com.fsck.k9.mail.Address) RobolectricTest(com.fsck.k9.RobolectricTest) Test(org.junit.Test)

Example 70 with Address

use of com.fsck.k9.mail.Address in project k-9 by k9mail.

the class MessageHelperTest method toFriendly_spoofPreventionDoesntOverrideContact.

@Test
public void toFriendly_spoofPreventionDoesntOverrideContact() {
    Address address = new Address("test@testor.com", "Tim Testor");
    CharSequence friendly = MessageHelper.toFriendly(address, contactsWithFakeSpoofContact, true, false, 0);
    assertEquals("Tim@Testor", friendly.toString());
}
Also used : Address(com.fsck.k9.mail.Address) RobolectricTest(com.fsck.k9.RobolectricTest) Test(org.junit.Test)

Aggregations

Address (com.fsck.k9.mail.Address)72 Test (org.junit.Test)40 Uri (android.net.Uri)13 RobolectricTest (com.fsck.k9.RobolectricTest)12 Message (com.fsck.k9.mail.Message)10 Date (java.util.Date)8 MimeMessage (com.fsck.k9.mail.internet.MimeMessage)7 ArrayList (java.util.ArrayList)7 MessagingException (com.fsck.k9.mail.MessagingException)6 Contacts (com.fsck.k9.helper.Contacts)5 Recipient (com.fsck.k9.view.RecipientSelectView.Recipient)5 AddressStyle (com.zegoggles.smssync.preferences.AddressStyle)5 IOException (java.io.IOException)5 Intent (android.content.Intent)4 Cursor (android.database.Cursor)4 MatrixCursor (android.database.MatrixCursor)4 AuthenticationFailedException (com.fsck.k9.mail.AuthenticationFailedException)4 CertificateValidationException (com.fsck.k9.mail.CertificateValidationException)4 TextBody (com.fsck.k9.mail.internet.TextBody)4 SpannableString (android.text.SpannableString)3