Add null as stripChar for Apache Commons StringUtils example

This commit is contained in:
Cavero Barca 2020-03-10 00:06:36 +01:00
parent 020c3bd8c9
commit aaabfa4ab2
2 changed files with 10 additions and 1 deletions

View File

@ -117,6 +117,9 @@ public class LTrimRTrim {
String ltrim = org.apache.commons.lang3.StringUtils.stripStart(src, " ");
String rtrim = org.apache.commons.lang3.StringUtils.stripEnd(src, " ");
ltrim = org.apache.commons.lang3.StringUtils.stripStart(src, null);
rtrim = org.apache.commons.lang3.StringUtils.stripEnd(src, null);
return checkStrings(ltrim, rtrim);
}

View File

@ -69,10 +69,16 @@ public class LTrimRTrimUnitTest {
// Use StringUtils containsIgnoreCase to avoid case insensitive issues
String ltrim = org.apache.commons.lang3.StringUtils.stripStart(src, " ");
String rtrim = org.apache.commons.lang3.StringUtils.stripEnd(src, " ");
// Compare the Strings obtained and the expected
Assert.assertTrue(ltrimResult.equalsIgnoreCase(ltrim));
Assert.assertTrue(rtrimResult.equalsIgnoreCase(rtrim));
ltrim = org.apache.commons.lang3.StringUtils.stripStart(src, null);
rtrim = org.apache.commons.lang3.StringUtils.stripEnd(src, null);
// Compare the Strings obtained and the expected
Assert.assertTrue(ltrimResult.equalsIgnoreCase(ltrim));
Assert.assertTrue(rtrimResult.equalsIgnoreCase(rtrim));
}