### Question:
StringUtil { public static String toClassCase(CharSequence str) { char[] s = str.toString().toCharArray(); StringBuilder builder = new StringBuilder(); boolean titleCaseNext = true; for (int i = 0; i < s.length; ++i) { if (!isLegalIdentifierCharacter(s[i], i)) { titleCaseNext = true; } else if (titleCaseNext) { builder.append(Character.toTitleCase(s[i])); titleCaseNext = false; } else { builder.append(s[i]); } } return builder.toString(); }  static String capitalize(Element element); static String capitalize(String str); static String uncapitalize(String str); static String toClassCase(CharSequence str); static String repeat(int n, String toRepeat, String delimiter);  }### Answer:
@Test void toClassCase_alreadyInClassCase_returnsSameString() { assertThat(StringUtil.toClassCase("ThisIsClassCase")).isEqualTo("ThisIsClassCase"); }
@Test void toClassCase_allLowerCase_capitalizeFirstLetter() { assertThat(StringUtil.toClassCase("class")).isEqualTo("Class"); }
@Test void toClassCase_containsNumericFirstCharacter_ignoreIllegalCharAndCapitalizeNext() { assertThat(StringUtil.toClassCase("1class")).isEqualTo("Class"); }
@Test void toClassCase_containsNumbersAsSubsequentCharacters_onlyCapitalizeFirstLetter() { assertThat(StringUtil.toClassCase("c1l3a4s5s6")).isEqualTo("C1l3a4s5s6"); }
@Test void toClassCase_containsIllegalChars_capitalizeLettersAfterIllegalChars() { assertThat(StringUtil.toClassCase("<table><One>")).isEqualTo("TableOne"); }
@Test void toClassCase_typicalDynamoIndexName_returnsClassCase() { assertThat(StringUtil.toClassCase("hash-key-range-key-index")).isEqualTo("HashKeyRangeKeyIndex"); }