Search in sources :

Example 41 with Html

use of com.fsck.k9.mail.internet.Viewable.Html in project k-9 by k9mail.

the class TextPartFinderTest method findFirstTextPart_withMultipartAlternativeContainingEmptyTextPlainPart.

@Test
public void findFirstTextPart_withMultipartAlternativeContainingEmptyTextPlainPart() throws Exception {
    BodyPart expected = createEmptyPart("text/plain");
    Part part = createMultipart("multipart/alternative", expected, createTextPart("text/html"));
    Part result = textPartFinder.findFirstTextPart(part);
    assertEquals(expected, result);
}
Also used : BodyPart(com.fsck.k9.mail.BodyPart) BodyPart(com.fsck.k9.mail.BodyPart) MessageCreationHelper.createEmptyPart(com.fsck.k9.message.MessageCreationHelper.createEmptyPart) Part(com.fsck.k9.mail.Part) MessageCreationHelper.createPart(com.fsck.k9.message.MessageCreationHelper.createPart) MessageCreationHelper.createTextPart(com.fsck.k9.message.MessageCreationHelper.createTextPart) Test(org.junit.Test)

Example 42 with Html

use of com.fsck.k9.mail.internet.Viewable.Html in project k-9 by k9mail.

the class TextPartFinderTest method findFirstTextPart_withMultipartAlternativeContainingMultipartRelatedContainingTextPlain.

@Test
public void findFirstTextPart_withMultipartAlternativeContainingMultipartRelatedContainingTextPlain() throws Exception {
    BodyPart expected = createTextPart("text/plain");
    Part part = createMultipart("multipart/alternative", createMultipart("multipart/related", expected, createPart("image/jpeg")), createTextPart("text/html"));
    Part result = textPartFinder.findFirstTextPart(part);
    assertEquals(expected, result);
}
Also used : BodyPart(com.fsck.k9.mail.BodyPart) BodyPart(com.fsck.k9.mail.BodyPart) MessageCreationHelper.createEmptyPart(com.fsck.k9.message.MessageCreationHelper.createEmptyPart) Part(com.fsck.k9.mail.Part) MessageCreationHelper.createPart(com.fsck.k9.message.MessageCreationHelper.createPart) MessageCreationHelper.createTextPart(com.fsck.k9.message.MessageCreationHelper.createTextPart) Test(org.junit.Test)

Example 43 with Html

use of com.fsck.k9.mail.internet.Viewable.Html in project k-9 by k9mail.

the class TextPartFinderTest method findFirstTextPart_withMultipartAlternative.

@Test
public void findFirstTextPart_withMultipartAlternative() throws Exception {
    BodyPart expected = createTextPart("text/plain");
    Part part = createMultipart("multipart/alternative", expected, createTextPart("text/html"));
    Part result = textPartFinder.findFirstTextPart(part);
    assertEquals(expected, result);
}
Also used : BodyPart(com.fsck.k9.mail.BodyPart) BodyPart(com.fsck.k9.mail.BodyPart) MessageCreationHelper.createEmptyPart(com.fsck.k9.message.MessageCreationHelper.createEmptyPart) Part(com.fsck.k9.mail.Part) MessageCreationHelper.createPart(com.fsck.k9.message.MessageCreationHelper.createPart) MessageCreationHelper.createTextPart(com.fsck.k9.message.MessageCreationHelper.createTextPart) Test(org.junit.Test)

Example 44 with Html

use of com.fsck.k9.mail.internet.Viewable.Html in project k-9 by k9mail.

the class TextPartFinderTest method findFirstTextPart_withMultipartMixedContainingTextHtmlFirst.

@Test
public void findFirstTextPart_withMultipartMixedContainingTextHtmlFirst() throws Exception {
    BodyPart expected = createTextPart("text/html");
    Part part = createMultipart("multipart/mixed", expected, createTextPart("text/plain"));
    Part result = textPartFinder.findFirstTextPart(part);
    assertEquals(expected, result);
}
Also used : BodyPart(com.fsck.k9.mail.BodyPart) BodyPart(com.fsck.k9.mail.BodyPart) MessageCreationHelper.createEmptyPart(com.fsck.k9.message.MessageCreationHelper.createEmptyPart) Part(com.fsck.k9.mail.Part) MessageCreationHelper.createPart(com.fsck.k9.message.MessageCreationHelper.createPart) MessageCreationHelper.createTextPart(com.fsck.k9.message.MessageCreationHelper.createTextPart) Test(org.junit.Test)

Example 45 with Html

use of com.fsck.k9.mail.internet.Viewable.Html in project k-9 by k9mail.

the class TextPartFinderTest method findFirstTextPart_withTextHtmlPart.

@Test
public void findFirstTextPart_withTextHtmlPart() throws Exception {
    Part part = createTextPart("text/html");
    Part result = textPartFinder.findFirstTextPart(part);
    assertEquals(part, result);
}
Also used : BodyPart(com.fsck.k9.mail.BodyPart) MessageCreationHelper.createEmptyPart(com.fsck.k9.message.MessageCreationHelper.createEmptyPart) Part(com.fsck.k9.mail.Part) MessageCreationHelper.createPart(com.fsck.k9.message.MessageCreationHelper.createPart) MessageCreationHelper.createTextPart(com.fsck.k9.message.MessageCreationHelper.createTextPart) Test(org.junit.Test)

Aggregations

Part (com.fsck.k9.mail.Part)31 BodyPart (com.fsck.k9.mail.BodyPart)24 Test (org.junit.Test)24 MessageCreationHelper.createTextPart (com.fsck.k9.message.MessageCreationHelper.createTextPart)12 MessageCreationHelper.createEmptyPart (com.fsck.k9.message.MessageCreationHelper.createEmptyPart)11 MessageCreationHelper.createPart (com.fsck.k9.message.MessageCreationHelper.createPart)11 ArrayList (java.util.ArrayList)11 MimeMessage (com.fsck.k9.mail.internet.MimeMessage)9 Body (com.fsck.k9.mail.Body)7 MimeBodyPart (com.fsck.k9.mail.internet.MimeBodyPart)7 Message (com.fsck.k9.mail.Message)6 Multipart (com.fsck.k9.mail.Multipart)6 TextBody (com.fsck.k9.mail.internet.TextBody)6 Viewable (com.fsck.k9.mail.internet.Viewable)6 Alternative (com.fsck.k9.mail.internet.Viewable.Alternative)4 Html (com.fsck.k9.mail.internet.Viewable.Html)4 Text (com.fsck.k9.mail.internet.Viewable.Text)4 MessageFormat (com.fsck.k9.Account.MessageFormat)3 K9RobolectricTest (com.fsck.k9.K9RobolectricTest)3 MessagingException (com.fsck.k9.mail.MessagingException)3