### Question:
TagsExportService { public String exportLocalizedTagsForPath(String path, ResourceResolver rr) { return exportLocalizedTagsForPath(path, rr, DEFAULT_LANGUAGE); }  String exportNonLocalizedTagsForPath(String path, ResourceResolver rr); String exportLocalizedTagsForPath(String path, ResourceResolver rr); String exportLocalizedTagsForPath(String path, ResourceResolver rr, String lang);  }### Answer:
@Test public void checkIsStructureExpected_toLocalized() { String result = tagsExportService.exportLocalizedTagsForPath("/etc/tags/root/brandTest", context.resourceResolver()); assertEquals(EXPECTED_OUTPUT_BRAND_TEST_LOCALIZED, result); }
@Test public void commasAreRemovedFromTitles_toLocalized() { String result = tagsExportService.exportLocalizedTagsForPath("/etc/tags/root/commaInTitles", context.resourceResolver()); assertEquals(EXPECTED_OUTPUT_COMMA_IN_TITLE_LOCALIZED, result); }
@Test public void wrongPathDoNotExportAnything_toLocalized() { String result = tagsExportService.exportLocalizedTagsForPath("/etc/wrong_tags/root/brandTest", context.resourceResolver()); assertEquals(EXPECTED_OUTPUT_WRONG_PATH_MESSAGE, result); }
@Test public void tagsWithoutLocalization_defaultLanguageWillBeUsed_toLocalized() { String result = tagsExportService.exportLocalizedTagsForPath("/etc/tags/root/zeroLocalizedTitle", context.resourceResolver()); assertEquals(EXPECTED_OUTPUT_UNLOCALIZED_TO_LOCALIZED_DEFAULT, result); }
@Test public void tagsWithoutLocalization_chosenLanguageWillBeUsed_toLocalized() { String result = tagsExportService.exportLocalizedTagsForPath("/etc/tags/root/zeroLocalizedTitle", context.resourceResolver(),"pl"); assertEquals(EXPECTED_OUTPUT_UNLOCALIZED_TO_LOCALIZED_PL, result); }
@Test public void tagsUnderCqTags_shouldRecognizeCorrectlyLocalized() { context.load() .json(getClass().getResourceAsStream("brandTestCqTags.json"), PATH_OVER_6_4); String result = tagsExportService.exportLocalizedTagsForPath("/content/cq:tags/root/brandTest", context.resourceResolver()); assertEquals(EXPECTED_OUTPUT_BRAND_TEST_LOCALIZED, result); }