### Question:
Strings { public static String getSanitizedMarkdownForFaqView(String md){ if(Strings.isNullOrEmpty(md)){ return "";} String output = md; Matcher imgMatcher = Pattern.compile("(!\\[[^\\]]+\\]\\((?!http)[^\\)]+\\))", Pattern.MULTILINE).matcher(md); while(imgMatcher.find()){ String group = imgMatcher.group(1); output = output.replace(group,""); } Matcher linkMatcher = Pattern.compile("\\[[^\\]]+\\]\\(((?!http)[^\\)]+)\\)", Pattern.MULTILINE).matcher(md); while(linkMatcher.find()){ String group = linkMatcher.group(1); output = output.replace(group,"https: } return output; }  static String getDescriptiveDurationString(int numberOfSeconds,
                                                      Context context); static String getBearingDescription(float bearingDegrees,
                                               Context context); static String cleanDescriptionForXml(String desc); static String cleanDescriptionForJson(String desc); static String getIsoDateTime(Date dateToFormat); static String getIsoDateTimeFormat(); static String getIsoCalendarDate(Date dateToFormat); static String getIsoCalendarDateFormat(); static String getReadableDateTime(Date dateToFormat); static boolean isNullOrEmpty(String text); static String htmlDecode(String text); static String getBuildSerial(); static String getFormattedFileName(); static String getFormattedFileName(Session session, PreferenceHelper ph); static String getFormattedCustomFileName(String baseName, Calendar calendar, PreferenceHelper ph); static int toInt(String number, int defaultVal); static String getSpeedDisplay(Context context, double metersPerSecond, boolean imperial); static String getDistanceDisplay(Context context, double meters, boolean imperial, boolean autoscale); static String getTimeDisplay(Context context, long milliseconds); static Map<String, String> getAvailableLocales(Context context); static String getSanitizedMarkdownForFaqView(String md); static String getDegreesMinutesSeconds(double decimaldegrees, boolean isLatitude); static String getDegreesDecimalMinutes(double decimaldegrees, boolean isLatitude); static String getDecimalDegrees(double decimaldegrees); static String getFormattedLatitude(double decimaldegrees); static String getFormattedLongitude(double decimaldegrees); static String getDetectedActivityName(DetectedActivity detectedActivity);  }### Answer:
@Test public void SanitizeMarkdownForHelpView_WhenLocalLinkPresent_ReturnsCodeWebsite() { String md = "### [Open source libraries used](opensourcelibraries.html)\n" + "\n" + "### [Donate Paypal](https: "This is [my screenshot](ss01.png)"; String expected = "### [Open source libraries used](https: "\n" + "### [Donate Paypal](https: "This is [my screenshot](https: assertThat("html link replaced with full URL", Strings.getSanitizedMarkdownForFaqView(md), is(expected)); }
@Test public void SanitizeMarkdownForHelpView_WhenAbsoluteUrlLinkPresent_DoesNotReplace() { String md = "First line \r\n " + "### [Donate Paypal](https: "[Donate coffee grounds](https: String expected = "First line \r\n " + "### [Donate Paypal](https: "[Donate coffee grounds](https: assertThat("Full URL not replaced", Strings.getSanitizedMarkdownForFaqView(md), is(expected)); }
@Test public void SanitizeMarkdownForHelpView_WhenNull_ReturnsEmpty() { String md = null; String expected = ""; assertThat("markdown returned is empty", Strings.getSanitizedMarkdownForFaqView(md), is(expected)); }
@Test public void SanitizeMarkdownForHelpView_WhenImagePresent_ImageRemoved(){ String md = "First line \r\n " + "![badge](This is my badge)\r\n " + "[Donate coffee grounds](https: String expected = "First line \r\n " + "\r\n " + "[Donate coffee grounds](https: assertThat("Image in MD is removed", Strings.getSanitizedMarkdownForFaqView(md), is(expected)); }