CaseSyntax { public String convert(String string) { return convert(string, 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 testConvert() { assertThat(CaseSyntax.PASCAL_CASE.convert(null)).isNull(); assertThat(CaseSyntax.PASCAL_CASE.convert("")).isEmpty(); assertThat(CaseSyntax.PASCAL_CASE.convert(" ")).isEmpty(); assertThat(CaseSyntax.PASCAL_CASE.convert("a0b-cd")).isEqualTo("A0bCd"); assertThat(CaseSyntax.PASCAL_CASE.convert("aBC DE")).isEqualTo("AbcDe"); assertThat(CaseSyntax.CAPITALIZED.convert("aBc-DEfg")).isEqualTo("ABcDEfg"); assertThat(CaseSyntax.TRAIN_CASE.convert(" ")).isEqualTo("-"); assertThat(CaseSyntax.TRAIN_CASE.convert("._")).isEqualTo("-"); assertThat(CaseSyntax.PASCAL_CASE.convert("InConSISTENTCase")).isEqualTo("InConSistentcase"); assertThat(CaseSyntax.CAML_SNAKE_CASE.convert("inconSistentcASE")).isEqualTo("incon_Sistentc_Ase"); assertThat(CaseSyntax.of(CaseSyntax.KEEP_SPECIAL_CHARS, UPPER_CASE).convert("ab-_c. d")).isEqualTo("AB-_C. D"); assertThat(CaseSyntax.CAML_CASE.convert(TestValues.THAI_SENTENCE)).isEqualTo("เดกทมปญหาทางการเรยนรบางคนสามารถเรยนรวมกบเดกปกตได"); }