I have a completable that looks like below which I'm trying to test with Mockito.
completable
.doOnSubscribe {
list.add(item)
}.doOnError {
list.remove(item)
//do other stuff
}.doOnComplete {
list.remove(item)
//do other stuff
}
That list manages a state that might be accessed elsewhere (another fragment or activity) to indicate how many items are still processing or if they're all complete.
I can't figure out how to unit test this directly other than creating a add() and remove() method, and then calling those, and using a spy to confirm it was called since subscribing to this immediately adds and removes it.
That seems a little overkill so I'm wondering if I'm missing a way to just trigger the doOnSubscribe portion?