@Test public void extractPreview_withSimpleTextHtml() throws Exception { String text = "<b>The quick brown fox jumps over the lazy dog</b>"; Part part = createTextPart("text/html", text); String preview = previewTextExtractor.extractPreview(part); assertEquals("The quick brown fox jumps over the lazy dog", preview); }
@NonNull public String extractPreview(@NonNull Part textPart) throws PreviewExtractionException { String text = MessageExtractor.getTextFromPart(textPart, MAX_CHARACTERS_CHECKED_FOR_PREVIEW); if (text == null) { throw new PreviewExtractionException("Couldn't get text from part"); } String plainText = convertFromHtmlIfNecessary(textPart, text); return stripTextForPreview(plainText); }
PreviewTextExtractor { @NonNull public String extractPreview(@NonNull Part textPart) throws PreviewExtractionException { String text = MessageExtractor.getTextFromPart(textPart, MAX_CHARACTERS_CHECKED_FOR_PREVIEW); if (text == null) { throw new PreviewExtractionException("Couldn't get text from part"); } String plainText = convertFromHtmlIfNecessary(textPart, text); return stripTextForPreview(plainText); } }
PreviewTextExtractor { @NonNull public String extractPreview(@NonNull Part textPart) throws PreviewExtractionException { String text = MessageExtractor.getTextFromPart(textPart, MAX_CHARACTERS_CHECKED_FOR_PREVIEW); if (text == null) { throw new PreviewExtractionException("Couldn't get text from part"); } String plainText = convertFromHtmlIfNecessary(textPart, text); return stripTextForPreview(plainText); }  }
PreviewTextExtractor { @NonNull public String extractPreview(@NonNull Part textPart) throws PreviewExtractionException { String text = MessageExtractor.getTextFromPart(textPart, MAX_CHARACTERS_CHECKED_FOR_PREVIEW); if (text == null) { throw new PreviewExtractionException("Couldn't get text from part"); } String plainText = convertFromHtmlIfNecessary(textPart, text); return stripTextForPreview(plainText); }  @NonNull String extractPreview(@NonNull Part textPart); }
PreviewTextExtractor { @NonNull public String extractPreview(@NonNull Part textPart) throws PreviewExtractionException { String text = MessageExtractor.getTextFromPart(textPart, MAX_CHARACTERS_CHECKED_FOR_PREVIEW); if (text == null) { throw new PreviewExtractionException("Couldn't get text from part"); } String plainText = convertFromHtmlIfNecessary(textPart, text); return stripTextForPreview(plainText); }  @NonNull String extractPreview(@NonNull Part textPart);  }