@Test public void testremoveWhiteSpaceNull() { ConvertString convertString = new ConvertString(); String input = ""; String cleanStr = convertString.removeRepeatedWhitespaces(input); Assert.assertEquals("", cleanStr); input = null; cleanStr = convertString.removeRepeatedWhitespaces(input); Assert.assertNull(cleanStr); }
public String removeRepeatedWhitespaces(String input) { if (StringUtils.isEmpty(input) || removeWhiteSpacesPattern == null) { return input; } Matcher matcher = removeWhiteSpacesPattern.matcher(input); return matcher.replaceAll("$1"); }
ConvertString { public String removeRepeatedWhitespaces(String input) { if (StringUtils.isEmpty(input) || removeWhiteSpacesPattern == null) { return input; } Matcher matcher = removeWhiteSpacesPattern.matcher(input); return matcher.replaceAll("$1"); } }
ConvertString { public String removeRepeatedWhitespaces(String input) { if (StringUtils.isEmpty(input) || removeWhiteSpacesPattern == null) { return input; } Matcher matcher = removeWhiteSpacesPattern.matcher(input); return matcher.replaceAll("$1"); } ConvertString();  ConvertString(String repeatStr); }
ConvertString { public String removeRepeatedWhitespaces(String input) { if (StringUtils.isEmpty(input) || removeWhiteSpacesPattern == null) { return input; } Matcher matcher = removeWhiteSpacesPattern.matcher(input); return matcher.replaceAll("$1"); } ConvertString();  ConvertString(String repeatStr); String removeTrailingAndLeadingWhitespaces(String input); String removeTrailingAndLeading(String input); String removeTrailingAndLeading(String input, String character); String removeRepeatedChar(String input); String removeRepeatedWhitespaces(String input); }
ConvertString { public String removeRepeatedWhitespaces(String input) { if (StringUtils.isEmpty(input) || removeWhiteSpacesPattern == null) { return input; } Matcher matcher = removeWhiteSpacesPattern.matcher(input); return matcher.replaceAll("$1"); } ConvertString();  ConvertString(String repeatStr); String removeTrailingAndLeadingWhitespaces(String input); String removeTrailingAndLeading(String input); String removeTrailingAndLeading(String input, String character); String removeRepeatedChar(String input); String removeRepeatedWhitespaces(String input); static final String[] WHITESPACE_CHARS; }