Advertisement
pellekrogholt

Untitled

Dec 9th, 2013
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. test("recovered standalone") {
  2.  
  3. val ex = new NoSuchElementException
  4.  
  5. // exception in the end
  6. val o1 = Observable(1, 2, 3) ++ Observable(ex)
  7. val o1Revocered = o1.recovered
  8. assert(o1Revocered.toBlockingObservable.toList === List(Success(1), Success(2), Success(3), Failure(ex)))
  9.  
  10.  
  11. // exception in the middle
  12. val o2 = Observable(1, 2) ++ Observable(ex) ++ Observable(3)
  13. val o2Revocered = o2.recovered
  14. assert(o2Revocered.toBlockingObservable.toList === List(Success(1), Success(2), Failure(ex), Success(3)))
  15.  
  16.  
  17. // exception in the end
  18. val o3 = Observable(1, 2, 3) ++ Observable(ex)
  19. val o3Revocered = o3.recovered
  20. assert(o3Revocered.toBlockingObservable.toList === List(Failure(ex), Success(1), Success(2), Success(3)))
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement