Skip to content

Instantly share code, notes, and snippets.

@mkoslacz
Created April 6, 2017 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkoslacz/50e1be76cf41b9806c03f3f5d28ab4b1 to your computer and use it in GitHub Desktop.
Save mkoslacz/50e1be76cf41b9806c03f3f5d28ab4b1 to your computer and use it in GitHub Desktop.
Traceur fails when using retry
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