JsoupUtils { @Nullable @WorkerThread public static CharSequence parse(@Nullable String text) { if (TextUtils.isEmpty(text)) { return null; } text = text.trim(); if (TextUtils.isEmpty(text)) { return null; } final Document document; try { document = Jsoup.parse(text, Constants.HUMMINGBIRD_URL_HTTPS); } catch (final Exception e) { Timber.e(TAG, "parse resulted in an exception", e); throw e; } if (document == null) { Timber.e(TAG, "parse resulted in a null document"); return null; } fixA(document); fixBlockquote(document); fixH(document); fixIframe(document); fixImg(document); stripScript(document); text = document.body().toString().trim(); if (TextUtils.isEmpty(text)) { return null; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return Html.fromHtml(text, Html.FROM_HTML_MODE_COMPACT); } else { return Html.fromHtml(text); } }  @Nullable static String getCsrfToken(@Nullable final String signInPage); @Nullable @WorkerThread static CharSequence parse(@Nullable String text);  }
@Test public void testParse() throws Exception { assertNull(JsoupUtils.parse(null)); assertNull(JsoupUtils.parse("")); assertNull(JsoupUtils.parse(" ")); assertNull(JsoupUtils.parse(" ")); assertNotNull(JsoupUtils.parse("Hello, World!")); }