I am testing some features of Rxjava2(2.0.7) and have some troubles in unit test
here is my code
RxJavaPlugins.setErrorHandler(null);
Observable<String> o = Observable.create((ObservableOnSubscribe<String>) e -> {
String s = System.currentTimeMillis() + "";
System.out.println("runing observable@" + s);
throw new RuntimeException();
}).delay(1, TimeUnit.SECONDS);
o
.doOnNext(x -> {
System.out.println(x);
throw new RuntimeException();
})
.doOnError(e->e.printStackTrace())
.test()
.assertNoErrors()
.awaitCount(1)
.awaitDone(5, TimeUnit.SECONDS);
The problem is this test always passed, but I can still find exception printed in log
What am I doing wrong?
Aucun commentaire:
Enregistrer un commentaire