Skip to content

2.x: TestSubscriber & TestObserver add assertValue(Predicate)#4607

Merged
akarnokd merged 2 commits intoReactiveX:2.xfrom
vanniktech:2.x_add_assert_value_predicate
Sep 26, 2016
Merged

2.x: TestSubscriber & TestObserver add assertValue(Predicate)#4607
akarnokd merged 2 commits intoReactiveX:2.xfrom
vanniktech:2.x_add_assert_value_predicate

Conversation

@vanniktech
Copy link
Collaborator

No description provided.


for (T value : values) {
try {
if (valuePredicate.test(value)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessary, just test values.get(0) and then report if s > 1 besides.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah thought of that too I just took the same implementation as assertError(predicate). I'll change it there too, ok?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't change assertError.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the first error may come from the lack of onSubscribe call or some other unexpected exception. Knowing that the exception is there but not the only one is different from expecting exactly 1 element but then getting n.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that makes sense. Thanks David for the explanation

@akarnokd akarnokd added this to the 2.0 RC4 milestone Sep 26, 2016
@akarnokd akarnokd merged commit 4f0791f into ReactiveX:2.x Sep 26, 2016
@vanniktech vanniktech deleted the 2.x_add_assert_value_predicate branch September 26, 2016 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants