Keep only null as stripChar in the Apache Commons example

This commit is contained in:
Cavero Barca
2020-03-10 14:17:19 +01:00
parent ab5f6b967a
commit 214ce71433
2 changed files with 4 additions and 14 deletions

View File

@@ -114,11 +114,8 @@ public class LTrimRTrim {
// Apache Commons StringUtils containsIgnoreCase
@Benchmark
public boolean apacheCommonsStringUtils() {
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);
String ltrim = org.apache.commons.lang3.StringUtils.stripStart(src, null);
String rtrim = org.apache.commons.lang3.StringUtils.stripEnd(src, null);
return checkStrings(ltrim, rtrim);
}

View File

@@ -67,15 +67,8 @@ public class LTrimRTrimUnitTest {
@Test
public void givenString_whenCallingStringUtilsStripStartEnd_thenReturnsTrue() {
// 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);
String ltrim = org.apache.commons.lang3.StringUtils.stripStart(src, null);
String rtrim = org.apache.commons.lang3.StringUtils.stripEnd(src, null);
// Compare the Strings obtained and the expected
Assert.assertTrue(ltrimResult.equalsIgnoreCase(ltrim));