Skip to content

1.x : the way to test that there is no output. #4320

Closed
@imcharsi

Description

@imcharsi

Hi

At first, My English is not good. forgive me.

I have a question.

Below is RxScala code but there should not be any problem about this question.

val subscriber = TestSubscriber[Int]
val subjectA = BehaviorSuject[Int](1)
subjectA.filter(_ > 1).subscribe(subscriber)
subscriber.assertNoValues()
subjectA.onNext(1)
subscriber.assertNoValues()
subjectA.onNext(2)
subscriber.assertValue(2)
// subscriber.virtualMethodThatClearInnerValues()
subjectA.onNext(1)
subscriber.assertNoValues() // failed
subscriber.assertValues(2) // passed

My question is "How can I test that there is no output?".

Currently, last assertion is passed with subscriber.assertValue(2) but not subscriber.assertNoValues().

Do you have any idea?

Thanks for reading.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions