Search in sources :

Example 6 with PreviewResult

use of com.fsck.k9.message.extractors.PreviewResult in project k-9 by k9mail.

the class MessagePreviewCreatorTest method createPreview_withoutTextPart.

@Test
public void createPreview_withoutTextPart() throws Exception {
    Message message = createDummyMessage();
    when(encryptionDetector.isEncrypted(message)).thenReturn(false);
    when(textPartFinder.findFirstTextPart(message)).thenReturn(null);
    PreviewResult result = previewCreator.createPreview(message);
    assertFalse(result.isPreviewTextAvailable());
    assertEquals(PreviewType.NONE, result.getPreviewType());
    verifyNoMoreInteractions(previewTextExtractor);
}
Also used : MimeMessage(com.fsck.k9.mail.internet.MimeMessage) Message(com.fsck.k9.mail.Message) Test(org.junit.Test)

Aggregations

MimeMessage (com.fsck.k9.mail.internet.MimeMessage)6 Message (com.fsck.k9.mail.Message)5 Test (org.junit.Test)5 Part (com.fsck.k9.mail.Part)3 MessageCreationHelper.createEmptyPart (com.fsck.k9.message.MessageCreationHelper.createEmptyPart)3 MessageCreationHelper.createTextPart (com.fsck.k9.message.MessageCreationHelper.createTextPart)3 ContentValues (android.content.ContentValues)1 MessagingException (com.fsck.k9.mail.MessagingException)1 WrappedException (com.fsck.k9.mailstore.LockableDatabase.WrappedException)1 AttachmentCounter (com.fsck.k9.message.extractors.AttachmentCounter)1 MessageFulltextCreator (com.fsck.k9.message.extractors.MessageFulltextCreator)1 MessagePreviewCreator (com.fsck.k9.message.extractors.MessagePreviewCreator)1 PreviewResult (com.fsck.k9.message.extractors.PreviewResult)1 PreviewType (com.fsck.k9.message.extractors.PreviewResult.PreviewType)1 IOException (java.io.IOException)1