### Question:
WordAnalysisSurfaceFormatter { public String formatToCase(SingleAnalysis analysis, CaseType type, String apostrophe) { String formatted = format(analysis, apostrophe); Locale locale = analysis.getDictionaryItem().hasAttribute(RootAttribute.LocaleEn) ? Locale.ENGLISH : Turkish.LOCALE; switch (type) { case DEFAULT_CASE: return formatted; case LOWER_CASE: return formatted.toLowerCase(locale); case UPPER_CASE: return formatted.toUpperCase(locale); case TITLE_CASE: return Turkish.capitalize(formatted); case UPPER_CASE_ROOT_LOWER_CASE_ENDING: String ending = analysis.getEnding(); String lemmaUpper = analysis.getDictionaryItem().normalizedLemma().toUpperCase(locale); if (ending.length() == 0) { return lemmaUpper; } if (apostrophe != null || apostropheRequired(analysis)) { if (apostrophe == null) { apostrophe = "'"; } return lemmaUpper + apostrophe + ending; } else { return lemmaUpper + ending; } default: return ""; } }  String format(SingleAnalysis analysis, String apostrophe); String format(SingleAnalysis analysis); String formatToCase(SingleAnalysis analysis, CaseType type, String apostrophe); String formatToCase(SingleAnalysis analysis, CaseType type); boolean canBeFormatted(SingleAnalysis analysis, CaseType type); CaseType guessCase(String input);  }### Answer:
@Test public void formatToCase() { TurkishMorphology morphology = TurkishMorphology.builder() .disableCache() .setLexicon("kış", "şiir", "Aydın", "Google [Pr:gugıl]") .build(); String[] inputs = {"aydında", "googledan", "Google", "şiirde", "kışçığa", "kış"}; String[] expectedDefaultCase = {"Aydın'da", "Google'dan", "Google", "şiirde", "kışçığa", "kış"}; String[] expectedLowerCase = {"aydın'da", "google'dan", "google", "şiirde", "kışçığa", "kış"}; String[] expectedUpperCase = {"AYDIN'DA", "GOOGLE'DAN", "GOOGLE", "ŞİİRDE", "KIŞÇIĞA", "KIŞ"}; String[] expectedCapitalCase = {"Aydın'da", "Google'dan", "Google", "Şiirde", "Kışçığa", "Kış"}; String[] expectedUpperRootLowerEndingCase = {"AYDIN'da", "GOOGLE'dan", "GOOGLE", "ŞİİRde", "KIŞçığa", "KIŞ"}; testCaseType(morphology, inputs, expectedDefaultCase, DEFAULT_CASE); testCaseType(morphology, inputs, expectedLowerCase, LOWER_CASE); testCaseType(morphology, inputs, expectedUpperCase, UPPER_CASE); testCaseType(morphology, inputs, expectedCapitalCase, TITLE_CASE); testCaseType(morphology, inputs, expectedUpperRootLowerEndingCase, UPPER_CASE_ROOT_LOWER_CASE_ENDING); }