Fixing Javadoc and adding Unit Test for the example for #LANG-261.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@411898 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
37b370c114
commit
80e957ecc4
|
@ -2197,7 +2197,7 @@ public class StringUtils {
|
|||
* StringUtils.splitPreserveAllTokens(null, *) = null
|
||||
* StringUtils.splitPreserveAllTokens("", *) = []
|
||||
* StringUtils.splitPreserveAllTokens("a.b.c", '.') = ["a", "b", "c"]
|
||||
* StringUtils.splitPreserveAllTokens("a..b.c", '.') = ["a", "b", "c"]
|
||||
* StringUtils.splitPreserveAllTokens("a..b.c", '.') = ["a", "", "b", "c"]
|
||||
* StringUtils.splitPreserveAllTokens("a:b:c", '.') = ["a:b:c"]
|
||||
* StringUtils.splitPreserveAllTokens("a\tb\nc", null) = ["a", "b", "c"]
|
||||
* StringUtils.splitPreserveAllTokens("a b c", ' ') = ["a", "b", "c"]
|
||||
|
|
|
@ -581,6 +581,16 @@ public class StringUtilsTest extends TestCase {
|
|||
assertEquals("b", res[3]);
|
||||
assertEquals("c", res[4]);
|
||||
|
||||
// Match example in javadoc
|
||||
{
|
||||
String[] results = null;
|
||||
String[] expectedResults = {"a", "", "b", "c"};
|
||||
results = StringUtils.splitPreserveAllTokens("a..b.c",'.');
|
||||
assertEquals(expectedResults.length, results.length);
|
||||
for (int i = 0; i < expectedResults.length; i++) {
|
||||
assertEquals(expectedResults[i], results[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testSplitPreserveAllTokens_StringString_StringStringInt() {
|
||||
|
@ -710,6 +720,7 @@ public class StringUtilsTest extends TestCase {
|
|||
assertEquals(expectedResults[i], results[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void innerTestSplitPreserveAllTokens(char separator, String sepStr, char noMatch) {
|
||||
|
|
Loading…
Reference in New Issue