@Test public void toUserData() { model.username = "name"; model.email = "email"; model.learningLanguage = "learn"; model.uiLanguage = "ui"; model.avatar = " LanguageDataModel langModel = mock(LanguageDataModel.class); Language language = Language.create("", "", 1, false, false); when(langModel.toLanguage()).thenReturn(language); model.languages = Collections.singletonList(langModel); UserData userData = model.toUserData(); assertThat(userData.getUiLanguageId(), equalTo("ui")); assertThat(userData.getLearningLanguageId(), equalTo("learn")); assertThat(userData.getUsername(), equalTo("name")); assertThat(userData.getAvatar(), equalTo(String.format(UserDataModel.URL_FORMAT, " assertThat(userData.getLanguages(), hasItem(language)); }
public UserData toUserData() { List<Language> list = Stream.of(wrapList(languages)) .map(LanguageDataModel::toLanguage) .collect(toList()); return UserData.create( list, String.format(URL_FORMAT, avatar), username, uiLanguage, learningLanguage); }
UserDataModel { public UserData toUserData() { List<Language> list = Stream.of(wrapList(languages)) .map(LanguageDataModel::toLanguage) .collect(toList()); return UserData.create( list, String.format(URL_FORMAT, avatar), username, uiLanguage, learningLanguage); } }
UserDataModel { public UserData toUserData() { List<Language> list = Stream.of(wrapList(languages)) .map(LanguageDataModel::toLanguage) .collect(toList()); return UserData.create( list, String.format(URL_FORMAT, avatar), username, uiLanguage, learningLanguage); }  }
UserDataModel { public UserData toUserData() { List<Language> list = Stream.of(wrapList(languages)) .map(LanguageDataModel::toLanguage) .collect(toList()); return UserData.create( list, String.format(URL_FORMAT, avatar), username, uiLanguage, learningLanguage); }  UserData toUserData(); }
UserDataModel { public UserData toUserData() { List<Language> list = Stream.of(wrapList(languages)) .map(LanguageDataModel::toLanguage) .collect(toList()); return UserData.create( list, String.format(URL_FORMAT, avatar), username, uiLanguage, learningLanguage); }  UserData toUserData();  }