use of com.fsck.k9.mail.Part 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.Part 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.Part 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.Part 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.Part in project k-9 by k9mail.
the class AttachmentInfoExtractorTest method extractInfo__withGenericPart_shouldThrow.
@Test(expected = IllegalArgumentException.class)
public void extractInfo__withGenericPart_shouldThrow() throws Exception {
Part part = mock(Part.class);
attachmentInfoExtractor.extractAttachmentInfo(part);
}
Aggregations