Skip to content

Instantly share code, notes, and snippets.

@talosdev
Created October 6, 2019 17:28
Show Gist options
  • Save talosdev/09e7645503e10247ef0b927e19e68929 to your computer and use it in GitHub Desktop.
Save talosdev/09e7645503e10247ef0b927e19e68929 to your computer and use it in GitHub Desktop.
@Test
fun `observable to single with first() and default value`() {
val observable = Observable.fromIterable<Int>((1..5).toList())
assertObservableToSingle(observable, { first(-1)}) {
assertComplete()
assertValue(1)
}
val emptyObservable = Observable.empty<Int>()
assertObservableToSingle(emptyObservable, { first(-1)}) {
assertComplete()
assertValue(-1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment