From 3dc67a2a4a5d190c3f4c417bb961f3acace003cc Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Thu, 7 Apr 2011 04:04:26 +0000 Subject: [PATCH] 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 --- .../apache/commons/lang3/StringUtilsStartsEndsWithTest.java | 3 +++ src/test/java/org/apache/commons/lang3/StringUtilsTest.java | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java index b851dcad2..9d6a3c478 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java @@ -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"))); } diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java index 600e48f63..c4073db6e 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java @@ -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() {