Update tests in AttachmentInfoExtractorTest
@@ -130,7 +130,7 @@ public class AttachmentInfoExtractorTest {
}
@Test
- public void extractInfoForDb__withDispositionInlineAndContentId__shouldReturnInlineAttachment()
+ public void extractInfoForDb__withDispositionInlineAndContentIdAndMissingMimeType__shouldNotReturnInlineAttachment()
throws Exception {
Part part = new MimeBodyPart();
part.addRawHeader(MimeHeader.HEADER_CONTENT_ID, MimeHeader.HEADER_CONTENT_ID + ": " + TEST_CONTENT_ID);
@@ -139,6 +139,20 @@ public class AttachmentInfoExtractorTest {
AttachmentViewInfo attachmentViewInfo = attachmentInfoExtractor.extractAttachmentInfoForDatabase(part);
+ assertFalse(attachmentViewInfo.inlineAttachment);
+ }
+
+ @Test
+ public void extractInfoForDb__withDispositionInlineAndContentIdAndImageMimeType__shouldReturnInlineAttachment()
+ throws Exception {
+ Part part = new MimeBodyPart();
+ part.addRawHeader(MimeHeader.HEADER_CONTENT_TYPE, MimeHeader.HEADER_CONTENT_TYPE + ": image/png");
+ part.addRawHeader(MimeHeader.HEADER_CONTENT_ID, MimeHeader.HEADER_CONTENT_ID + ": " + TEST_CONTENT_ID);
+ part.addRawHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, MimeHeader.HEADER_CONTENT_DISPOSITION + ": " +
+ "inline" + ";\n filename=\"filename.ext\";\n meaningless=\"dummy\"");
+
+ AttachmentViewInfo attachmentViewInfo = attachmentInfoExtractor.extractAttachmentInfoForDatabase(part);
+
assertTrue(attachmentViewInfo.inlineAttachment);
}
