Search in sources :

Example 76 with Multipart

use of com.fsck.k9.mail.Multipart 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 77 with Multipart

use of com.fsck.k9.mail.Multipart 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 78 with Multipart

use of com.fsck.k9.mail.Multipart 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 79 with Multipart

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

the class TextPartFinderTest method findFirstTextPart_withMultipartMixedNotContainingTextPart.

@Test
public void findFirstTextPart_withMultipartMixedNotContainingTextPart() throws Exception {
    Part part = createMultipart("multipart/mixed", createPart("image/jpeg"), createPart("image/gif"));
    Part result = textPartFinder.findFirstTextPart(part);
    assertNull(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)

Example 80 with Multipart

use of com.fsck.k9.mail.Multipart 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)

Aggregations

BodyPart (com.fsck.k9.mail.BodyPart)57 Part (com.fsck.k9.mail.Part)51 Test (org.junit.Test)47 MimeBodyPart (com.fsck.k9.mail.internet.MimeBodyPart)38 Multipart (com.fsck.k9.mail.Multipart)33 MimeMessage (com.fsck.k9.mail.internet.MimeMessage)29 Message (com.fsck.k9.mail.Message)25 Body (com.fsck.k9.mail.Body)22 MimeMultipart (com.fsck.k9.mail.internet.MimeMultipart)21 ArrayList (java.util.ArrayList)14 MessageCreationHelper.createEmptyPart (com.fsck.k9.message.MessageCreationHelper.createEmptyPart)13 MessageCreationHelper.createPart (com.fsck.k9.message.MessageCreationHelper.createPart)13 MessageCreationHelper.createTextPart (com.fsck.k9.message.MessageCreationHelper.createTextPart)13 ByteArrayOutputStream (java.io.ByteArrayOutputStream)8 TextBody (com.fsck.k9.mail.internet.TextBody)7 MessagingException (com.fsck.k9.mail.MessagingException)6 Stack (java.util.Stack)6 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)5 FetchProfile (com.fsck.k9.mail.FetchProfile)5 BinaryTempFileBody (com.fsck.k9.mail.internet.BinaryTempFileBody)5