@Test public void loadUserData() { when(accountModule.getUserId()).thenReturn(Optional.of("id")); UserDataModel model = mock(UserDataModel.class); UserData userData = UserData.create(Collections.emptyList(), "", "", "", ""); when(model.toUserData()).thenReturn(userData); when(service.getUserData("id")).thenReturn(Call.just(model)); TestObserver<UserData> observer = new TestObserver<>(); module.loadUserData().enqueue(observer); observer.assertValue(userData); }
@Override public Call<UserData> loadUserData() { return service.getUserData(accountModule.getUserId().get()) .map(UserDataModel::toUserData); }
RestSettingsModule implements SettingsModule { @Override public Call<UserData> loadUserData() { return service.getUserData(accountModule.getUserId().get()) .map(UserDataModel::toUserData); } }
RestSettingsModule implements SettingsModule { @Override public Call<UserData> loadUserData() { return service.getUserData(accountModule.getUserId().get()) .map(UserDataModel::toUserData); } @Inject  RestSettingsModule(RestService service, AccountModule accountModule); }
RestSettingsModule implements SettingsModule { @Override public Call<UserData> loadUserData() { return service.getUserData(accountModule.getUserId().get()) .map(UserDataModel::toUserData); } @Inject  RestSettingsModule(RestService service, AccountModule accountModule); @Override Call<UserData> loadUserData(); @Override Call<Object> switchLanguage(Language language); }
RestSettingsModule implements SettingsModule { @Override public Call<UserData> loadUserData() { return service.getUserData(accountModule.getUserId().get()) .map(UserDataModel::toUserData); } @Inject  RestSettingsModule(RestService service, AccountModule accountModule); @Override Call<UserData> loadUserData(); @Override Call<Object> switchLanguage(Language language);  }