use of com.fsck.k9.mail.internet.MimeBodyPart in project k-9 by k9mail.
the class LocalStoreTest method findPartById__withNestedLocalMessagePart.
@Test
public void findPartById__withNestedLocalMessagePart() throws Exception {
LocalBodyPart searchRoot = new LocalBodyPart(null, null, 1L, -1L);
LocalMimeMessage needlePart = new LocalMimeMessage(null, null, 123L);
MimeMultipart mimeMultipart = new MimeMultipart("boundary");
mimeMultipart.addBodyPart(new MimeBodyPart(needlePart));
searchRoot.setBody(mimeMultipart);
Part part = LocalStore.findPartById(searchRoot, 123L);
assertSame(needlePart, part);
}
use of com.fsck.k9.mail.internet.MimeBodyPart in project k-9 by k9mail.
the class AttachmentInfoExtractorTest method extractInfoForDb__withNoBody__shouldReturnContentNotAvailable.
@Test
public void extractInfoForDb__withNoBody__shouldReturnContentNotAvailable() throws Exception {
MimeBodyPart part = new MimeBodyPart();
AttachmentViewInfo attachmentViewInfo = attachmentInfoExtractor.extractAttachmentInfoForDatabase(part);
assertFalse(attachmentViewInfo.isContentAvailable);
}
use of com.fsck.k9.mail.internet.MimeBodyPart in project k-9 by k9mail.
the class AttachmentInfoExtractorTest method extractInfoForDb__withNoBody__shouldReturnContentAvailable.
@Test
public void extractInfoForDb__withNoBody__shouldReturnContentAvailable() throws Exception {
MimeBodyPart part = new MimeBodyPart();
part.setBody(new TextBody("data"));
AttachmentViewInfo attachmentViewInfo = attachmentInfoExtractor.extractAttachmentInfoForDatabase(part);
assertTrue(attachmentViewInfo.isContentAvailable);
}
use of com.fsck.k9.mail.internet.MimeBodyPart in project k-9 by k9mail.
the class AttachmentInfoExtractorTest method extractInfoForDb__withNoHeaders__shouldReturnEmptyValues.
@Test
public void extractInfoForDb__withNoHeaders__shouldReturnEmptyValues() throws Exception {
MimeBodyPart part = new MimeBodyPart();
AttachmentViewInfo attachmentViewInfo = attachmentInfoExtractor.extractAttachmentInfoForDatabase(part);
assertEquals(Uri.EMPTY, attachmentViewInfo.internalUri);
assertEquals(AttachmentViewInfo.UNKNOWN_SIZE, attachmentViewInfo.size);
assertEquals("noname.txt", attachmentViewInfo.displayName);
assertEquals("text/plain", attachmentViewInfo.mimeType);
assertFalse(attachmentViewInfo.inlineAttachment);
}
use of com.fsck.k9.mail.internet.MimeBodyPart in project k-9 by k9mail.
the class AttachmentInfoExtractorTest method extractInfoForDb__withDispositionAttach__shouldReturnNamedAttachment.
@Test
public void extractInfoForDb__withDispositionAttach__shouldReturnNamedAttachment() throws Exception {
MimeBodyPart part = new MimeBodyPart();
part.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, "attachment" + "; filename=\"filename.ext\"; meaningless=\"dummy\"");
AttachmentViewInfo attachmentViewInfo = attachmentInfoExtractor.extractAttachmentInfoForDatabase(part);
assertEquals(Uri.EMPTY, attachmentViewInfo.internalUri);
assertEquals("filename.ext", attachmentViewInfo.displayName);
assertFalse(attachmentViewInfo.inlineAttachment);
}
Aggregations