CaseSyntax { private static CaseSyntax ofStandardized(Character separator, CaseConversion first, CaseConversion wordStart, CaseConversion other) { for (CaseSyntax syntax : CONSTANTS) { if (Objects.equals(separator, syntax.wordSeparator) && (first == syntax.firstCase) && (wordStart == syntax.wordStartCase) && (other == syntax.otherCase)) { return syntax; } } return null; } private  CaseSyntax(Character separator, CaseConversion allCharCase, String example); private  CaseSyntax(Character separator, CaseConversion firstCharCase, CaseConversion wordStartCharCase, String example); private  CaseSyntax(Character separator, CaseConversion firstCharCase, CaseConversion wordStartCharCase, CaseConversion otherCharCase, String example); private  CaseSyntax(Character separator, CaseConversion firstCharCase, CaseConversion wordStartCharCase, CaseConversion otherCharCase, String example,
      boolean register); Character getWordSeparator(); boolean hasWordSeparator(); CaseConversion getFirstCase(); CaseConversion getWordStartCase(); CaseConversion getOtherCase(); String convert(String string); String convert(String string, Locale locale); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); static CaseSyntax of(Character separator, CaseConversion allCharCase); static CaseSyntax of(Character separator, CaseConversion firstCharCase, CaseConversion wordStartCharCase); static CaseSyntax of(Character separator, CaseConversion firstCharCase, CaseConversion wordStartCharCase, CaseConversion otherCharCase); static String normalizeExample(String example); static CaseSyntax ofExample(String example, boolean standardize); static final Character KEEP_SPECIAL_CHARS; static final CaseSyntax LOWERCASE; static final CaseSyntax UPPERCASE; static final CaseSyntax CAML_CASE; static final CaseSyntax PASCAL_CASE; static final CaseSyntax TRAIN_CASE; static final CaseSyntax UPPER_TRAIN_CASE; static final CaseSyntax PASCAL_TRAIN_CASE; static final CaseSyntax CAML_TRAIN_CASE; static final CaseSyntax LOWER_SNAKE_CASE; static final CaseSyntax UPPER_SNAKE_CASE; static final CaseSyntax PASCAL_SNAKE_CASE; static final CaseSyntax CAML_SNAKE_CASE; static final CaseSyntax LOWER_SPACE_CASE; static final CaseSyntax UPPER_SPACE_CASE; static final CaseSyntax PASCAL_SPACE_CASE; static final CaseSyntax CAML_SPACE_CASE; static final CaseSyntax UNMODIFIED; static final CaseSyntax CAPITALIZED; static final CaseSyntax UNCAPITALIZED; static final CaseSyntax CAPITALIZED_LOWER; static final CaseSyntax UNCAPITALIZED_UPPER; }
@Test public void testOfStandardized() { Character separator = null; assertThat(CaseSyntax.of(separator, LOWER_CASE)).isSameAs(CaseSyntax.LOWERCASE); assertThat(CaseSyntax.of(separator, UPPER_CASE)).isSameAs(CaseSyntax.UPPERCASE); assertThat(CaseSyntax.of(separator, UPPER_CASE, UPPER_CASE, LOWER_CASE)).isSameAs(CaseSyntax.PASCAL_CASE); assertThat(CaseSyntax.of(separator, LOWER_CASE, UPPER_CASE, LOWER_CASE)).isSameAs(CaseSyntax.CAML_CASE); assertThat(CaseSyntax.of(separator, UPPER_CASE, ORIGINAL_CASE, ORIGINAL_CASE)).isSameAs(CaseSyntax.CAPITALIZED); assertThat(CaseSyntax.of(separator, UPPER_CASE, LOWER_CASE)).isSameAs(CaseSyntax.CAPITALIZED_LOWER); assertThat(CaseSyntax.of(separator, LOWER_CASE, UPPER_CASE, UPPER_CASE)).isSameAs(CaseSyntax.UNCAPITALIZED_UPPER); separator = Character.valueOf('-'); assertThat(CaseSyntax.of(separator, LOWER_CASE)).isSameAs(CaseSyntax.TRAIN_CASE); assertThat(CaseSyntax.of(separator, UPPER_CASE)).isSameAs(CaseSyntax.UPPER_TRAIN_CASE); assertThat(CaseSyntax.of(separator, UPPER_CASE, UPPER_CASE)).isSameAs(CaseSyntax.PASCAL_TRAIN_CASE); assertThat(CaseSyntax.of(separator, LOWER_CASE, UPPER_CASE)).isSameAs(CaseSyntax.CAML_TRAIN_CASE); separator = Character.valueOf('_'); assertThat(CaseSyntax.of(separator, LOWER_CASE)).isSameAs(CaseSyntax.LOWER_SNAKE_CASE); assertThat(CaseSyntax.of(separator, UPPER_CASE)).isSameAs(CaseSyntax.UPPER_SNAKE_CASE); assertThat(CaseSyntax.of(separator, UPPER_CASE, UPPER_CASE)).isSameAs(CaseSyntax.PASCAL_SNAKE_CASE); assertThat(CaseSyntax.of(separator, LOWER_CASE, UPPER_CASE)).isSameAs(CaseSyntax.CAML_SNAKE_CASE); separator = Character.valueOf(' '); assertThat(CaseSyntax.of(separator, LOWER_CASE)).isSameAs(CaseSyntax.LOWER_SPACE_CASE); assertThat(CaseSyntax.of(separator, UPPER_CASE)).isSameAs(CaseSyntax.UPPER_SPACE_CASE); assertThat(CaseSyntax.of(separator, UPPER_CASE, UPPER_CASE)).isSameAs(CaseSyntax.PASCAL_SPACE_CASE); assertThat(CaseSyntax.of(separator, LOWER_CASE, UPPER_CASE)).isSameAs(CaseSyntax.CAML_SPACE_CASE); }