SvgTextUtil { public static String trimTrailingWhitespace(String toTrim) { if (toTrim == null) { return ""; } int end = toTrim.length(); if (end > 0) { int current = end - 1; while (current >= 0) { char currentChar = toTrim.charAt(current); if (Character.isWhitespace(currentChar) && !(currentChar == '\n' || currentChar == '\r')) { current--; } else { break; } } if (current < 0) { return ""; } else { return toTrim.substring(0, current + 1); } } else { return toTrim; } } private  SvgTextUtil(); static String trimLeadingWhitespace(String toTrim); static String trimTrailingWhitespace(String toTrim); static void processWhiteSpace(TextSvgBranchRenderer root, boolean isLeadingElement); static boolean isOnlyWhiteSpace(String s); static float resolveFontSize(ISvgTextNodeRenderer renderer, float parentFontSize); static String filterReferenceValue(String name);  }
@Test public void trimTrailingTest() { String toTrim = "\t \t to trim \t"; String actual = SvgTextUtil.trimTrailingWhitespace(toTrim); String expected = "\t \t to trim"; Assert.assertEquals(expected, actual); }
@Test public void trimTrailingEmptyTest() { String toTrim = ""; String actual = SvgTextUtil.trimTrailingWhitespace(toTrim); String expected = ""; Assert.assertEquals(expected, actual); }
@Test public void trimTrailingNoTrailingTest() { String toTrim = " to Test"; String actual = SvgTextUtil.trimTrailingWhitespace(toTrim); String expected = " to Test"; Assert.assertEquals(expected, actual); }
@Test public void trimTrailingSingleWhiteSpaceTest() { String toTrim = " to Test "; String actual = SvgTextUtil.trimTrailingWhitespace(toTrim); String expected = " to Test"; Assert.assertEquals(expected, actual); }
@Test public void trimTrailingNonBreakingSpaceTest() { String toTrim = " to Test\u00A0"; String actual = SvgTextUtil.trimTrailingWhitespace(toTrim); String expected = " to Test\u00A0"; Assert.assertEquals(expected, actual); }
@Test public void trimTrailingOnlyWhitespaceTest() { String toTrim = "\t\t\t \t\t\t"; String actual = SvgTextUtil.trimTrailingWhitespace(toTrim); String expected = ""; Assert.assertEquals(expected, actual); }
@Test public void trimTrailingLineBreakTest() { String toTrim = " to trim \n"; String actual = SvgTextUtil.trimTrailingWhitespace(toTrim); String expected = " to trim \n"; Assert.assertEquals(expected, actual); }
@Test public void trimNullTrailingTest() { String expected = ""; String actual = SvgTextUtil.trimTrailingWhitespace(null); Assert.assertEquals(expected, actual); }
@Test public void trimTrailingOfStringWithLength1Test() { String toTrim = "A"; String actual = SvgTextUtil.trimTrailingWhitespace(toTrim); String expected = "A"; Assert.assertEquals(expected, actual); }