use of com.fsck.k9.mail.internet.Viewable.Text in project k-9 by k9mail.
the class PreviewTextExtractorTest method extractPreview_shouldStripQuoteHeaderAndQuotedText.
@Test
public void extractPreview_shouldStripQuoteHeaderAndQuotedText() throws Exception {
String text = "" + "some text\r\n" + "On 01/02/03 someone wrote\r\n" + "> some quoted text\r\n" + "# some other quoted text\r\n";
Part part = createTextPart("text/plain", text);
String preview = previewTextExtractor.extractPreview(part);
assertEquals("some text", preview);
}
use of com.fsck.k9.mail.internet.Viewable.Text in project k-9 by k9mail.
the class PreviewTextExtractorTest method extractPreview_withLongTextPlain.
@Test
public void extractPreview_withLongTextPlain() throws Exception {
String text = "" + "10--------20--------30--------40--------50--------" + "60--------70--------80--------90--------100-------" + "110-------120-------130-------140-------150-------" + "160-------170-------180-------190-------200-------" + "210-------220-------230-------240-------250-------" + "260-------270-------280-------290-------300-------" + "310-------320-------330-------340-------350-------" + "360-------370-------380-------390-------400-------" + "410-------420-------430-------440-------450-------" + "460-------470-------480-------490-------500-------" + "510-------520-------";
Part part = createTextPart("text/plain", text);
String preview = previewTextExtractor.extractPreview(part);
assertEquals(text.substring(0, 511) + "…", preview);
}
use of com.fsck.k9.mail.internet.Viewable.Text in project k-9 by k9mail.
the class PreviewTextExtractorTest method extractPreview_shouldStripGenericQuoteHeader.
@Test
public void extractPreview_shouldStripGenericQuoteHeader() throws Exception {
String text = "" + "Am 13.12.2015 um 23:42 schrieb Hans:\r\n" + "> hallo\r\n" + "hi there\r\n";
Part part = createTextPart("text/plain", text);
String preview = previewTextExtractor.extractPreview(part);
assertEquals("hi there", preview);
}
use of com.fsck.k9.mail.internet.Viewable.Text 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.Viewable.Text in project k-9 by k9mail.
the class EncryptionDetectorTest method isEncrypted_withTextPlain_shouldReturnFalse.
@Test
public void isEncrypted_withTextPlain_shouldReturnFalse() throws Exception {
Message message = createTextMessage("text/plain", "plain text");
boolean encrypted = encryptionDetector.isEncrypted(message);
assertFalse(encrypted);
}
Aggregations