@Test public void testGetSupportedLanguages_emitsCorrectLanguages() { Language de = new Language("German", LanguageCode.DE); Language en = new Language("English", LanguageCode.EN); List<Language> languages = Arrays.asList(de, en); Observable<List<Language>> mockObservable = Observable.just(languages); doReturn(mockObservable).when(mDataModel).getObservableSupportedLanguages(); Language hr = new Language("Slovakian", LanguageCode.HR); List<Language> expectedLanguages = Arrays.asList(de, en, hr); TestSubscriber<List<Language>> testSubscriber = new TestSubscriber<>(); mMainViewModel.getObservableSupportedLanguages().subscribe(testSubscriber); testSubscriber.assertNoErrors(); testSubscriber.assertUnsubscribed(); testSubscriber.assertTerminalEvent(); String threadname = testSubscriber.getLastSeenThread().getName(); System.out.println("threadname " + threadname); List<List<Language>> listlistresult = testSubscriber.getOnNextEvents(); System.out.println("listlistresult " + listlistresult.get(0).toString()); List<Language> listresult = listlistresult.get(0); System.out.println("listresult0 " + listresult.get(0).getName()); System.out.println("listresult1 " + listresult.get(1).getName()); assertEquals(expectedLanguages.get(0).getName(), listresult.get(0).getName()); assertThat(languages, hasSize(2)); }
@NonNull public Observable<List<Language>> getObservableSupportedLanguages() { return mDataModel.getObservableSupportedLanguages(); }
EmployeeMvvmViewModel { @NonNull public Observable<List<Language>> getObservableSupportedLanguages() { return mDataModel.getObservableSupportedLanguages(); } }
EmployeeMvvmViewModel { @NonNull public Observable<List<Language>> getObservableSupportedLanguages() { return mDataModel.getObservableSupportedLanguages(); } EmployeeMvvmViewModel(@NonNull final EmployeeIDataModel dataModel,
                         @NonNull final ISchedulerProvider schedulerProvider); }
EmployeeMvvmViewModel { @NonNull public Observable<List<Language>> getObservableSupportedLanguages() { return mDataModel.getObservableSupportedLanguages(); } EmployeeMvvmViewModel(@NonNull final EmployeeIDataModel dataModel,
                         @NonNull final ISchedulerProvider schedulerProvider); void saveRxFBemployee(); @NonNull Observable<String> getObservableFob(); Observable<List<Employee>> getObservableEmployees(); Observable<DataSnapshot> getObservableFBabsences(); Observable<DataSnapshot> getObservableFBusers(); Observable<List<Employee>> getObservableFBusersEmployee(); void getBySpinnerEmloyee(String[] conditionsx); @NonNull Observable<List<Employee>> getObservableFBusersEmployeeSpinner(); void saveEditEmloyee(@NonNull final Employee employee, String namexx, String oscxx,
                                              String icoxx, String typxx, String uswxx); @NonNull Observable<String> getObservableKeyEditedEmployee(); @NonNull Observable<String> getObservableGreeting(); @NonNull Observable<List<Language>> getObservableSupportedLanguages(); void emitlanguageSelected(@NonNull final Language language); int getValue(@NonNull int xxx); }
EmployeeMvvmViewModel { @NonNull public Observable<List<Language>> getObservableSupportedLanguages() { return mDataModel.getObservableSupportedLanguages(); } EmployeeMvvmViewModel(@NonNull final EmployeeIDataModel dataModel,
                         @NonNull final ISchedulerProvider schedulerProvider); void saveRxFBemployee(); @NonNull Observable<String> getObservableFob(); Observable<List<Employee>> getObservableEmployees(); Observable<DataSnapshot> getObservableFBabsences(); Observable<DataSnapshot> getObservableFBusers(); Observable<List<Employee>> getObservableFBusersEmployee(); void getBySpinnerEmloyee(String[] conditionsx); @NonNull Observable<List<Employee>> getObservableFBusersEmployeeSpinner(); void saveEditEmloyee(@NonNull final Employee employee, String namexx, String oscxx,
                                              String icoxx, String typxx, String uswxx); @NonNull Observable<String> getObservableKeyEditedEmployee(); @NonNull Observable<String> getObservableGreeting(); @NonNull Observable<List<Language>> getObservableSupportedLanguages(); void emitlanguageSelected(@NonNull final Language language); int getValue(@NonNull int xxx);  }