void start() {
bar.foo()
.filter(i -> i % 2 == 0)
.subscribeOn(computation())
.observeOn(io())
.subscribe(new FooSubscriber());
}
In this function I see 3 points to test:
- Verify that I call
bar.foo()
. - Verify that the
filter
is correctly implemented. - Verify that I'm subscribed to
bar.foo()
.
The first point is easy to test with Mockito.verify()
. But I have no idea about how to test the other points.
How can I test this code? Must I refactor it? How?
Please, think that filter
is just an example, I have a big chain with different operators.
Aucun commentaire:
Enregistrer un commentaire