Added CharSequence endsWithAny and startsWithAny tests

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1089725 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2011-04-07 04:04:26 +00:00
parent cc3b4d31bc
commit 3dc67a2a4a
2 changed files with 7 additions and 0 deletions

View File

@ -17,6 +17,7 @@
package org.apache.commons.lang3;
import junit.framework.TestCase;
import org.apache.commons.lang3.text.StrBuilder;
/**
* Unit tests {@link org.apache.commons.lang3.StringUtils} - StartsWith/EndsWith methods
@ -144,6 +145,8 @@ public class StringUtilsStartsEndsWithTest extends TestCase {
assertTrue("StringUtils.endsWithAny(abcxyz, new String[] {null, xyz, abc})", StringUtils.endsWithAny("abcxyz", new String[] {null, "xyz", "abc"}));
assertFalse("StringUtils.endsWithAny(defg, new String[] {null, xyz, abc})", StringUtils.endsWithAny("defg", new String[] {null, "xyz", "abc"}));
assertTrue("StringUtils.endsWithAny(abcxyz, StringBuilder(abc), StringBuffer(xyz))", StringUtils.endsWithAny("abcxyz", new StringBuilder("abc"), new StringBuffer("xyz")));
assertTrue("StringUtils.endsWithAny( StrBuilder(abcxyz), StringBuilder(abc), StringBuffer(xyz))", StringUtils.endsWithAny( new StrBuilder("abcxyz"), new StringBuilder("abc"), new StringBuffer("xyz")));
}

View File

@ -26,6 +26,7 @@ import java.util.Locale;
import junit.framework.TestCase;
import org.apache.commons.lang3.text.StrBuilder;
import org.apache.commons.lang3.text.WordUtils;
/**
@ -1871,6 +1872,9 @@ public class StringUtilsTest extends TestCase {
assertTrue(StringUtils.startsWithAny("abcxyz", "abc"));
assertTrue(StringUtils.startsWithAny("abcxyz", null, "xyz", "abc"));
assertFalse(StringUtils.startsWithAny("abcxyz", null, "xyz", "abcd"));
assertTrue("StringUtils.startsWithAny(abcxyz, StringBuilder(xyz), StringBuffer(abc))", StringUtils.startsWithAny("abcxyz", new StringBuilder("xyz"), new StringBuffer("abc")));
assertTrue("StringUtils.startsWithAny( StrBuilder(abcxyz), StringBuilder(xyz), StringBuffer(abc))", StringUtils.startsWithAny( new StrBuilder("abcxyz"), new StringBuilder("xyz"), new StringBuffer("abc")));
}
public void testNormalizeSpace() {