### Question:
WordAnalysisSurfaceFormatter { public String format(SingleAnalysis analysis, String apostrophe) { DictionaryItem item = analysis.getDictionaryItem(); String ending = analysis.getEnding(); if (apostrophe != null || apostropheRequired(analysis)) { if (apostrophe == null) { apostrophe = "'"; } return ending.length() > 0 ? item.normalizedLemma() + apostrophe + ending : item.normalizedLemma(); } else { if (item.attributes.contains(RootAttribute.NoQuote)) { return item.normalizedLemma() + ending; } else { return analysis.getStem() + ending; } } }  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 formatNonProperNoun() { TurkishMorphology morphology = TurkishMorphology.builder() .disableCache() .setLexicon("elma", "kitap", "demek", "evet") .build(); String[] inputs = {"elmamadaki", "elma", "kitalarımdan", "kitabımızsa", "diyebileceğimiz", "dedi", "evet"}; WordAnalysisSurfaceFormatter formatter = new WordAnalysisSurfaceFormatter(); for (String input : inputs) { WordAnalysis results = morphology.analyze(input); for (SingleAnalysis result : results) { Assert.assertEquals(input, formatter.format(result, null)); } } }
@Test public void formatNumerals() { TurkishMorphology morphology = TurkishMorphology.builder().disableCache().build(); String[] inputs = {"1e", "4ten", "123ü", "12,5ten"}; String[] expected = {"1'e", "4'ten", "123'ü", "12,5ten"}; WordAnalysisSurfaceFormatter formatter = new WordAnalysisSurfaceFormatter(); int i = 0; for (String input : inputs) { WordAnalysis results = morphology.analyze(input); for (SingleAnalysis result : results) { if (result.getDictionaryItem().primaryPos == PrimaryPos.Numeral) { Assert.assertEquals(expected[i], formatter.format(result, "'")); } } i++; } }