### Question:
HTMLParser { public static String removeNonTextTagsAndAttributes(String html) { html = removeNonTextTags(html); Matcher m = REMOVE_ATTRIBUTES_PATTERN.matcher(html); if(m.find()) { html = m.replaceAll("<$1$2>"); } html = unescapeHtml(html); return html; }  static String replaceImgWithAlt(String html); static String removeComments(String html); static String unsafeRemoveAllTags(String html); static String safeRemoveAllTags(String html); static String removeNonTextTagsAndAttributes(String html); static String extractText(String html); static String extractTitle(String html); static Map<HyperlinkPart, List<String>> extractHyperlinks(String html); static Map<String, String> extractMetatags(String html); static Map<String, List<String>> extractHTMLheaders(String html);  }### Answer:
@Test public void testRemoveNonTextTagsAndAttributes() { logger.info("testRemoveNonTextTagsAndAttributes"); String text = "<html><head>INVISIBLE</head><body>" + "<!-- INISIBLE -->" + "<style>INVISIBLE</style>" + "<script>INVISIBLE</script>" + "<object>INVISIBLE</object>" + "<embed>INVISIBLE</embed>" + "<applet>INVISIBLE</applet>" + "<noframes>INVISIBLE</noframes>" + "<noscript>INVISIBLE</noscript>" + "<noembed>INVISIBLE</noembed>" + "<option>INVISIBLE</option>" + "<div>visible1&#39;s</div>" + "<img src=\"\" />" + "<img src=\"\" />" + "<br>" + "test!" + "</body></html>"; String expResult = "<html> <body> <div>visible1's</div><img/><img/><br>test!</body></html>"; String result = StringCleaner.removeExtraSpaces(HTMLParser.removeNonTextTagsAndAttributes(text)); assertEquals(expResult, result); }