### Question:
HtmlHelper { public String colorSubstring(String str, String color, int start, int end) { if (str == null || str.isEmpty()) { return ""; } color = formatColorHexCode(color); try { return str.substring(0, start) + wrapInColorTags(str.substring(start, end), color) + str.substring(end); } catch (StringIndexOutOfBoundsException e) { return ""; } }  String colorSubstring(String str, String color, int start, int end);  }### Answer:
@Test public void it_wraps_the_start_of_a_string_in_font_tags() { String result = mHtmlHelper.colorSubstring("This is a test string", "#FFFFFF", 0, 4); assertEquals("<font color=\"#FFFFFF\">This</font> is a test string", result); }
@Test public void it_wraps_the_middle_of_a_string_in_font_tags() { String result = mHtmlHelper.colorSubstring("This is a test string", "#FFFFFF", 5, 9); assertEquals("This <font color=\"#FFFFFF\">is a</font> test string", result); }
@Test public void it_wraps_the_end_of_a_string_in_font_tags() { String result = mHtmlHelper.colorSubstring("This is a test string", "#FFFFFF", 15, 21); assertEquals("This is a test <font color=\"#FFFFFF\">string</font>", result); }
@Test public void it_formats_the_color_code_correctly_with_or_without_hash_prefix() { String result = mHtmlHelper.colorSubstring("This is a test string", "FFFFFF", 0, 4); assertEquals("<font color=\"#FFFFFF\">This</font> is a test string", result); result = mHtmlHelper.colorSubstring("This is a test string", "#FFFFFF", 0, 4); assertEquals("<font color=\"#FFFFFF\">This</font> is a test string", result); }