use of com.fsck.k9.mail.BodyPart in project k-9 by k9mail.
the class MessageDecryptVerifierTest method findEncrypted__withMultipartEncrypted__shouldReturnRoot.
@Test
public void findEncrypted__withMultipartEncrypted__shouldReturnRoot() throws Exception {
Message message = messageFromBody(multipart("encrypted", bodypart("application/pgp-encrypted"), bodypart("application/octet-stream")));
List<Part> encryptedParts = MessageDecryptVerifier.findEncryptedParts(message);
assertEquals(1, encryptedParts.size());
assertSame(message, encryptedParts.get(0));
}
use of com.fsck.k9.mail.BodyPart 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);
}
use of com.fsck.k9.mail.BodyPart 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);
}
use of com.fsck.k9.mail.BodyPart 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);
}
use of com.fsck.k9.mail.BodyPart 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);
}
Aggregations