### Question:
StringProcessor { public static String truncateHTML(String html, int maxCharCount) { List<String> htmlList = new ArrayList<>(Arrays.asList(html.split(""))); boolean canDelete = true; boolean hasRemoved = false; for (int ii = htmlList.size() - 1; ii > -1; ii--) { if (htmlList.get(ii).equals(">")) { canDelete = false; continue; } else if (htmlList.get(ii).equals("<")) { canDelete = true; continue; } if (ii < maxCharCount) { if (hasRemoved && canDelete) { if (!"<".equals(htmlList.get(ii + 1))) { htmlList.set(ii + 1, " ... "); } else { htmlList.set(ii, " ... "); } } break; } if (canDelete && ii > maxCharCount) { htmlList.set(ii, ""); hasRemoved = true; } } html = String.join("", htmlList); return html; }  static ObjectMapper defaultObjectMapper(); static String getResourceNameFromUrl(String url); static String getJustFileName(String originalFilename); static List<String> extractUrls(String text); static String stripeExtendedChars(String data); static String createHrefUrls(String text); static String createHrefUrls(String text, boolean showFullURL); static String stripeFieldJSON(String json, Set<String> fieldsToKeep); static String printObject(Object o); static String ellipseString(String data, int max_length); static String blankIfNull(String text); static String blankIfNull(Object text); static String nullIfBlank(String text); static Boolean isEmail(String text); static String stripHtml(String text); static BigDecimal archtecureCodeToDecimal(String code); static String urlEncode(String value); static String urlDecode(String value); static String parseStackTraceHtml(Throwable throwable); static String enclose(String s); static String enclose(String s, String enclose); static String enclose(String s, String encloseStart, String encloseEnd); static String encodeWebKey(String key); static String cleanEntityKey(String key); static String getFileExtension(String filename); static String cleanFileName(String badFileName); static String puralize(int size, String nonPuralForm, String puralForm); static String getHexFromBytes(byte[] bytes); static String decodeHexCharEscapes(String input); static boolean stringIsNotBlank(String input); static String formatForFilename(String input); static String uniqueId(); static String truncateHTML(String html, int maxCharCount); static Map<String, List<String>> splitURLQuery(String query); static String removeBadStyles(String html); static String escapeHtmlQuotes(String input);  }### Answer:
@Test public void testTruncateHTML() { System.out.println("truncateHTML"); String html = "<b>test</b><br><br>abcdssa<b>"; int maxCharCount = 10; String expResult = "<b>test</b><br><br><b>"; String result = StringProcessor.truncateHTML(html, maxCharCount); assertEquals(expResult, result); }