Last active
December 30, 2015 20:19
-
-
Save pellekrogholt/7880159 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test("recovered standalone") { | |
val ex = new NoSuchElementException | |
// exception in the end | |
val o1 = Observable(1, 2, 3) ++ Observable(ex) | |
val o1Revocered = o1.recovered | |
assert(o1Revocered.toBlockingObservable.toList === List(Success(1), Success(2), Success(3), Failure(ex))) | |
// exception in the middle | |
val o2 = Observable(1, 2) ++ Observable(ex) ++ Observable(3) | |
val o2Revocered = o2.recovered | |
assert(o2Revocered.toBlockingObservable.toList === List(Success(1), Success(2), Failure(ex))) | |
// NOT: | |
// assert(o2Revocered.toBlockingObservable.toList === List(Success(1), Success(2), Failure(ex), Success(3))) | |
// exception in the beginning | |
val o3 = Observable(ex) ++ Observable(1, 2, 3) | |
val o3Revocered = o3.recovered | |
assert(o3Revocered.toBlockingObservable.toList === List(Failure(ex))) | |
// not | |
// assert(o3Revocered.toBlockingObservable.toList === List(Failure(ex), Success(1), Success(2), Success(3))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment