LANG-1059 Capitalize javadoc is incorrect

Add test to show that first character is upcased, not the first
(alphabetic) letter that is found
This commit is contained in:
Sebb 2015-06-12 17:45:57 +01:00
parent 5f479e70cd
commit 78e2f4c122
2 changed files with 8 additions and 0 deletions

View File

@ -5749,6 +5749,7 @@ public class StringUtils {
* StringUtils.capitalize("") = ""
* StringUtils.capitalize("cat") = "Cat"
* StringUtils.capitalize("cAt") = "CAt"
* StringUtils.capitalize("'cat'") = "'cat'"
* </pre>
*
* @param str the String to capitalize, may be null

View File

@ -249,6 +249,13 @@ public class StringUtilsTest {
FOO_CAP, StringUtils.capitalize(FOO_CAP));
assertEquals("capitalize(string) failed",
FOO_CAP, StringUtils.capitalize(FOO_UNCAP));
// Javadoc examples
assertNull(StringUtils.capitalize(null));
assertEquals("", StringUtils.capitalize(""));
assertEquals("Cat", StringUtils.capitalize("cat"));
assertEquals("CAt", StringUtils.capitalize("cAt"));
assertEquals("'cat'", StringUtils.capitalize("'cat'"));
}
@Test