### Question:
LanguageListConverter { public List<String> convert(LanguageList languageList) { if (languageList == null) { return null; } return toSliLanguageList(languageList.getLanguages()); }  List<String> convert(LanguageList languageList);  }### Answer:
@Test public void testNullObject() { List<String> result = converter.convert(null); Assert.assertNull("Address list should be null", result); }
@Test public void testEmptyList() { List<String> result = converter.convert(new LanguageList()); Assert.assertEquals(0, result.size()); }
@Test public void testEmptyLanguage() { LanguageList list = new LanguageList(); openadk.library.common.Language original = new openadk.library.common.Language(); list.add(original); List<String> result = converter.convert(list); Assert.assertEquals(1, result.size()); String language = result.get(0); Assert.assertEquals("Other", language); }
@Test public void testConversion() { map.clear(); map.put(LanguageCode.CHECHEN, "Other languages"); map.put(LanguageCode.CHEROKEE, "Cherokee"); map.put(LanguageCode.CHINESE, "Mandarin (Chinese)"); map.put(LanguageCode.ENGLISH, "English"); map.put(LanguageCode.FRENCH, "French"); map.put(LanguageCode.GERMAN, "German"); map.put(LanguageCode.HAWAIIAN, "Other languages"); map.put(LanguageCode.HEBREW, "Hebrew"); map.put(LanguageCode.ITALIAN, "Italian"); map.put(LanguageCode.JAPANESE, "Japanese"); map.put(LanguageCode.KOREAN, "Korean"); map.put(LanguageCode.MOHAWK, "Other languages"); map.put(LanguageCode.MULTIPLE, "Other languages"); map.put(LanguageCode.SPANISH, "Spanish"); map.put(LanguageCode.wrap("something else"), "Other"); List<LanguageCode> languageCodes = new ArrayList<LanguageCode>(); languageCodes.addAll(map.keySet()); LanguageList originalList = new LanguageList(); for (LanguageCode languageCode : languageCodes) { originalList.add(new Language(languageCode)); } List<String> convertedList = converter.convert(originalList); Assert.assertEquals(originalList.size(), convertedList.size()); int i = 0; for (String converted : convertedList) { LanguageCode original = languageCodes.get(i++); Assert.assertEquals(converted, map.get(original)); } }