### Question:
MediaWikiUtil { public static String stripMediaWikiMarkup(String markup) { Validate.notNull(markup, "markup must not be null"); String result = REF_PATTERN.matcher(markup).replaceAll(""); result = result.replaceAll("<gallery(?:\\s[^>]*)?>[^<]*</gallery>", ""); result = StringEscapeUtils.unescapeHtml4(result); result = HtmlHelper.stripHtmlTags(result); result = HEADING_PATTERN.matcher(result).replaceAll("$1\n"); result = result.replaceAll("'''''|'''|''", ""); result = CONVERT_PATTERN.matcher(result).replaceAll("$1 $2"); result = replaceLangPattern(result); result = processLinks(result, INTERNAL_LINK_PATTERN); result = processLinks(result, EXTERNAL_LINK_PATTERN); result = removeBetween(result, '{', '{', '}', '}'); result = removeBetween(result, '{', '|', '|', '}'); result = result.replaceAll("\\[\\[[^]]*\\]\\]", ""); result = result.replaceAll("(?<!\n)\n(?![*\n])", " "); result = StringHelper.removeDoubleWhitespaces(result); result = result.replaceAll("\n{2,}", "\n\n"); result = result.trim(); return result; } private  MediaWikiUtil(); static String stripMediaWikiMarkup(String markup); static String extractSentences(String text); static final WikiPage retrieveArticle(MediaWikiDescriptor descriptor, String title); static final List<WikiPageReference> retrieveArticlesForCategory(MediaWikiDescriptor descriptor,
            String categoryName); static final WikiPageReference retrieveRandomArticle(MediaWikiDescriptor descriptor); static final List<WikiPageReference> retrieveBacklinks(MediaWikiDescriptor descriptor, String pageName); static WikiTemplate extractTemplate(String markup); static List<String> getNamedMarkup(String markup, String... names); static void parseDump(File wikipediaDump, Consumer<WikiPage> action, ProgressReporter progress); static void parseDump(File wikipediaDump, Consumer<WikiPage> action); static void parseDump(InputStream inputStream, Consumer<WikiPage> action); static void main(String[] args); static final Pattern HEADING_PATTERN; static final Pattern INTERNAL_LINK_PATTERN; static final Pattern REDIRECT_PATTERN; }### Answer:
@Test public void testStripMarkup() throws IOException { String markup = FileHelper.readFileToString(ResourceHelper.getResourceFile("/wikipedia/Dresden.wikipedia")); String cleanText = MediaWikiUtil.stripMediaWikiMarkup(markup); assertEquals(44999, cleanText.length()); assertEquals(82215810, cleanText.hashCode()); markup = FileHelper.readFileToString(ResourceHelper .getResourceFile("/wikipedia/LutonAirportParkwayRailwayStation.wikipedia")); cleanText = MediaWikiUtil.stripMediaWikiMarkup(markup); assertEquals(2743, cleanText.length()); assertEquals(-1897009842, cleanText.hashCode()); markup = FileHelper.readFileToString(ResourceHelper .getResourceFile("/wikipedia/MiddlesbroughTransporterBridge.wikipedia")); cleanText = MediaWikiUtil.stripMediaWikiMarkup(markup); assertEquals(6376, cleanText.length()); assertEquals(-2062978054, cleanText.hashCode()); }