@Test public void toVocabularyData() throws Exception { VocabularyResponseModel.VocabularyResponseWordModel wordModel = new VocabularyResponseModel.VocabularyResponseWordModel(); wordModel.gender = "gender"; wordModel.id = "id"; wordModel.normalizedString = "norm"; wordModel.pos = "pos"; wordModel.strengthBars = 3; wordModel.wordString = "word"; model.wordList = Collections.singletonList(wordModel); model.fromLanguage = "from"; model.learningLanguage = "learn"; VocabularyData data = model.toVocabularyData(); assertThat(data.getLearningLanguageId(), equalTo("learn")); assertThat(data.getUiLanguageId(), equalTo("from")); VocabularyWord word = VocabularyWord .create( "word", "norm", Optional.of("pos"), Optional.of("gender"), 3, Collections.emptyList(), "from", "learn"); assertThat(data.getWords(), contains(word)); }
public VocabularyData toVocabularyData() { List<VocabularyWord> list = Stream.of(wordList) .map(word -> word.toVocabularyWord(fromLanguage, learningLanguage)) .collect(toList()); return VocabularyData.create(list, fromLanguage, learningLanguage); }
VocabularyResponseModel { public VocabularyData toVocabularyData() { List<VocabularyWord> list = Stream.of(wordList) .map(word -> word.toVocabularyWord(fromLanguage, learningLanguage)) .collect(toList()); return VocabularyData.create(list, fromLanguage, learningLanguage); } }
VocabularyResponseModel { public VocabularyData toVocabularyData() { List<VocabularyWord> list = Stream.of(wordList) .map(word -> word.toVocabularyWord(fromLanguage, learningLanguage)) .collect(toList()); return VocabularyData.create(list, fromLanguage, learningLanguage); }  }
VocabularyResponseModel { public VocabularyData toVocabularyData() { List<VocabularyWord> list = Stream.of(wordList) .map(word -> word.toVocabularyWord(fromLanguage, learningLanguage)) .collect(toList()); return VocabularyData.create(list, fromLanguage, learningLanguage); }  VocabularyData toVocabularyData(); }
VocabularyResponseModel { public VocabularyData toVocabularyData() { List<VocabularyWord> list = Stream.of(wordList) .map(word -> word.toVocabularyWord(fromLanguage, learningLanguage)) .collect(toList()); return VocabularyData.create(list, fromLanguage, learningLanguage); }  VocabularyData toVocabularyData();  }