Clean Apache Commons and Guava functions and tests

This commit is contained in:
Cavero Barca
2020-03-06 21:58:00 +01:00
parent 17c42c903b
commit 9c162e8b91
2 changed files with 10 additions and 26 deletions

View File

@@ -4,6 +4,8 @@ import org.apache.commons.lang3.StringUtils;
import org.junit.Assert;
import org.junit.Test;
import com.google.common.base.CharMatcher;
import java.util.regex.Pattern;
/**
@@ -53,8 +55,8 @@ public class LTrimRTrimUnitTest {
@Test
public void givenString_whenCallingGuavaCharMatcher_thenReturnsTrue() {
// Use StringUtils containsIgnoreCase to avoid case insensitive issues
String ltrim = LTrimRTrim.guavaLtrim(src);
String rtrim = LTrimRTrim.guavaRtrim(src);
String ltrim = CharMatcher.whitespace().trimLeadingFrom(src);;
String rtrim = CharMatcher.whitespace().trimTrailingFrom(src);
// Compare the Strings obtained and the expected
Assert.assertTrue(ltrimResult.equalsIgnoreCase(ltrim));
@@ -65,8 +67,8 @@ public class LTrimRTrimUnitTest {
@Test
public void givenString_whenCallingStringUtilsStripStartEnd_thenReturnsTrue() {
// Use StringUtils containsIgnoreCase to avoid case insensitive issues
String ltrim = LTrimRTrim.stringUtilsLTrim(src);
String rtrim = LTrimRTrim.stringUtilsRTrim(src);
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));