Skip to content

Assertions

Ruby Lichtenshtein edited this page Apr 12, 2018 · 7 revisions

Assertions are the glue that connects TestObserver/TestSubscriber and Matcher.

Example

testObserver should complete()

testSubscriber shouldHave value("Hello!")

RxTest Assertions

  • should <Matcher>
  • shouldHave <Matcher>
  • shouldBe <Matcher>
  • shouldEmit <Matcher>

shouldEmit and shouldNeverEmit are special assertions that already contain matcher.

ShouldEmit is the assertion shouldHave with the matcher value.

  • shouldEmit <T>
  • shouldEmit <(T) -> Boolean>

shouldNeverEmit is the assertion should with the matcher never.

  • shouldNeverEmit <T>
  • shouldNeverEmit <(T) -> Boolean>