Skip to content

Instantly share code, notes, and snippets.

@talosdev
Last active October 6, 2019 16:08
Show Gist options
  • Select an option

  • Save talosdev/c4d4a87004d05dc412254f58511b7131 to your computer and use it in GitHub Desktop.

Select an option

Save talosdev/c4d4a87004d05dc412254f58511b7131 to your computer and use it in GitHub Desktop.
@Test
fun `observable to single with firstOrError`() {
val observable = Observable.fromIterable<Int>((1..5).toList())
.doOnNext { println("Source observable emitting $it") }
val single = observable.firstOrError()
.doOnSuccess { println("Single succeeded with value: $it") }
val testObserver = single.test().await()
testObserver.apply {
assertComplete()
assertValue(1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment