Created
April 6, 2017 13:06
-
-
Save mkoslacz/50e1be76cf41b9806c03f3f5d28ab4b1 to your computer and use it in GitHub Desktop.
Traceur fails when using retry
This file contains 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
class TraceurRetryFailureShowcase { | |
@Test | |
fun usingRetryWithTraceurFails() { | |
Traceur.enableLogging() | |
val publishSubject = PublishSubject.create<Int>() | |
val errors = mutableListOf<Throwable>() | |
publishSubject | |
.flatMap { Observable.error<Any>(RuntimeException()) } | |
.doOnError { errors.add(it) } | |
.retry() | |
.subscribe() | |
publishSubject.onNext(1) | |
publishSubject.onNext(2) | |
Assert.assertEquals(2, errors.size) | |
} | |
@Test | |
fun usingRetryWithoutTraceurPasses() { | |
// Traceur.enableLogging() | |
val publishSubject = PublishSubject.create<Int>() | |
val errors = mutableListOf<Throwable>() | |
publishSubject | |
.flatMap { Observable.error<Any>(RuntimeException()) } | |
.doOnError { errors.add(it) } | |
.retry() | |
.subscribe() | |
publishSubject.onNext(1) | |
publishSubject.onNext(2) | |
Assert.assertEquals(2, errors.size) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment