@Test public void testLanguages() throws SifTranslationException { StudentPersonal info = new StudentPersonal(); Demographics demographics = new Demographics(); LanguageList languageList = new LanguageList(); languageList.addLanguage(LanguageCode.ENGLISH); languageList.addLanguage(LanguageCode.CHINESE); demographics.setLanguageList(languageList); info.setDemographics(demographics); Mockito.when(mockLanguageListConverter.convert(Mockito.any(LanguageList.class))).thenReturn(Arrays.asList("English", "Chinese")); List<StudentEntity> result = translator.translate(info, null); Assert.assertEquals(1, result.size()); StudentEntity entity = result.get(0); List<String> list = entity.getLanguages(); Assert.assertEquals(2, list.size()); Assert.assertEquals("language[0] is expected to be 'English'", "English", list.get(0)); Assert.assertEquals("language[1] is expected to be 'Chinese'", "Chinese", list.get(1)); list = entity.getHomeLanguages(); Assert.assertNull("Home Languages was not null", list); }
private List<String> getHomeLanguages(LanguageList languageList) { Language[] languages = languageList == null ? null : languageList.getLanguages(); if (languages == null) { return null; } LanguageList homeList = new LanguageList(); for (Language language : languages) { if (language.getLanguageType() != null && LanguageType.HOME.valueEquals(language.getLanguageType())) { homeList.add(language); } } return homeList.size() == 0 ? null : languageListConverter.convert(homeList); }
StudentPersonalTranslationTask extends AbstractTranslationTask<StudentPersonal, StudentEntity> { private List<String> getHomeLanguages(LanguageList languageList) { Language[] languages = languageList == null ? null : languageList.getLanguages(); if (languages == null) { return null; } LanguageList homeList = new LanguageList(); for (Language language : languages) { if (language.getLanguageType() != null && LanguageType.HOME.valueEquals(language.getLanguageType())) { homeList.add(language); } } return homeList.size() == 0 ? null : languageListConverter.convert(homeList); } }
StudentPersonalTranslationTask extends AbstractTranslationTask<StudentPersonal, StudentEntity> { private List<String> getHomeLanguages(LanguageList languageList) { Language[] languages = languageList == null ? null : languageList.getLanguages(); if (languages == null) { return null; } LanguageList homeList = new LanguageList(); for (Language language : languages) { if (language.getLanguageType() != null && LanguageType.HOME.valueEquals(language.getLanguageType())) { homeList.add(language); } } return homeList.size() == 0 ? null : languageListConverter.convert(homeList); } StudentPersonalTranslationTask(); }
StudentPersonalTranslationTask extends AbstractTranslationTask<StudentPersonal, StudentEntity> { private List<String> getHomeLanguages(LanguageList languageList) { Language[] languages = languageList == null ? null : languageList.getLanguages(); if (languages == null) { return null; } LanguageList homeList = new LanguageList(); for (Language language : languages) { if (language.getLanguageType() != null && LanguageType.HOME.valueEquals(language.getLanguageType())) { homeList.add(language); } } return homeList.size() == 0 ? null : languageListConverter.convert(homeList); } StudentPersonalTranslationTask(); @Override List<StudentEntity> doTranslate(StudentPersonal sifData, String zoneId); }
StudentPersonalTranslationTask extends AbstractTranslationTask<StudentPersonal, StudentEntity> { private List<String> getHomeLanguages(LanguageList languageList) { Language[] languages = languageList == null ? null : languageList.getLanguages(); if (languages == null) { return null; } LanguageList homeList = new LanguageList(); for (Language language : languages) { if (language.getLanguageType() != null && LanguageType.HOME.valueEquals(language.getLanguageType())) { homeList.add(language); } } return homeList.size() == 0 ? null : languageListConverter.convert(homeList); } StudentPersonalTranslationTask(); @Override List<StudentEntity> doTranslate(StudentPersonal sifData, String zoneId);  }