Words { public static String capitalize(String str) { return capitalize(str, null); } private  Words(); static String wrap(String str, int wrapLength); static String wrap(String str, int wrapLength, String newLineStr, boolean wrapLongWords); static String capitalize(String str); static String capitalize(String str, char[] delimiters); static String capitalizeFully(String str); static String capitalizeFully(String str, char[] delimiters); static String uncapitalize(String str); static String uncapitalize(String str, char[] delimiters); static String initials(String str); static String initials(String str, char[] delimiters);  }
@Test public void testCapitalize_String() { assertEquals(null, capitalize(null)); assertEquals("", capitalize("")); assertEquals(" ", capitalize(" ")); assertEquals("I", capitalize("I")); assertEquals("I", capitalize("i")); assertEquals("I Am Here 123", capitalize("i am here 123")); assertEquals("I Am Here 123", capitalize("I Am Here 123")); assertEquals("I Am HERE 123", capitalize("i am HERE 123")); assertEquals("I AM HERE 123", capitalize("I AM HERE 123")); }
@Test public void testCapitalizeWithDelimiters_String() { assertEquals(null, capitalize(null, null)); assertEquals("", capitalize("", new char[0])); assertEquals(" ", capitalize(" ", new char[0])); char[] chars = new char[]{'-', '+', ' ', '@'}; assertEquals("I", capitalize("I", chars)); assertEquals("I", capitalize("i", chars)); assertEquals("I-Am Here+123", capitalize("i-am here+123", chars)); assertEquals("I Am+Here-123", capitalize("I Am+Here-123", chars)); assertEquals("I+Am-HERE 123", capitalize("i+am-HERE 123", chars)); assertEquals("I-AM HERE+123", capitalize("I-AM HERE+123", chars)); chars = new char[]{'.'}; assertEquals("I aM.Fine", capitalize("i aM.fine", chars)); assertEquals("I Am.fine", capitalize("i am.fine", null)); }