dimanche 25 février 2018

Unit Testing RxJava doOnSubscribe and doFinally

How do I create a unit test that a certain side effect is done on doOnScubscribe and doFinally of an rxjava chain?

For Example:

Observable.requestSomeValueFromWeb()
            .doOnSubscribe(() -> showLoading = true)
            .doFinally(() -> showLoading = false)
            .subscribe(result -> doSomething(result), error -> doErrorHandling(error));

how do I test in the scenario above that the "showLoading" was set to true on subscribe and false when the observable was disposed?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire