Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.x: Add assertValueSetOnly and assertValueSequenceOnly to TestObserver + TestSubscriber #6010

Merged
merged 3 commits into from
May 18, 2018
Merged

2.x: Add assertValueSetOnly and assertValueSequenceOnly to TestObserver + TestSubscriber #6010

merged 3 commits into from
May 18, 2018

Conversation

vanniktech
Copy link
Collaborator

This basically copies the behavior of assertValuesOnly to the assertValueSet and assertValueSequence equivalent methods.

Coped the tests exactly from assertValuesOnly and adjusted them with the new added methods.

* Assert that the TestObserver/TestSubscriber received only the specified values in any order without terminating.
* @param values the values expected
* @return this;
* @since 2.1.14
Copy link
Member

Choose a reason for hiding this comment

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

Please have these like this: 2.1.14 - experimental


try {
to.assertValueSetOnly(Collections.singleton(5));
fail();
Copy link
Member

Choose a reason for hiding this comment

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

fail throws AssertionError so this test always passes. Perhaps throw a RuntimeException or add a fail message and verify the catch wasn't that message. Also this is overlooked in many other test using fail and catch (AssertionError) so it would be great if this could be fixed as well.

Copy link
Member

@akarnokd akarnokd left a comment

Choose a reason for hiding this comment

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

Some changes would be great.

@codecov
Copy link

codecov bot commented May 17, 2018

Codecov Report

Merging #6010 into 2.x will decrease coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6010      +/-   ##
============================================
- Coverage     98.28%   98.25%   -0.04%     
- Complexity     6074     6158      +84     
============================================
  Files           658      659       +1     
  Lines         44288    44522     +234     
  Branches       6145     6201      +56     
============================================
+ Hits          43529    43743     +214     
- Misses          228      233       +5     
- Partials        531      546      +15
Impacted Files Coverage Δ Complexity Δ
.../java/io/reactivex/observers/BaseTestConsumer.java 100% <100%> (ø) 116 <2> (+2) ⬆️
.../operators/observable/ObservableFlatMapSingle.java 88.8% <0%> (-2.99%) 2% <0%> (ø)
...activex/internal/observers/QueueDrainObserver.java 97.43% <0%> (-2.57%) 21% <0%> (-1%)
...nternal/operators/observable/ObservableWindow.java 98% <0%> (-2%) 3% <0%> (ø)
.../io/reactivex/disposables/CompositeDisposable.java 98.14% <0%> (-1.86%) 39% <0%> (-1%)
...x/internal/operators/flowable/FlowablePublish.java 97.44% <0%> (-1.71%) 11% <0%> (ø)
...rnal/operators/observable/ObservableSwitchMap.java 93.61% <0%> (-1.6%) 3% <0%> (ø)
...l/operators/observable/ObservableFlatMapMaybe.java 88.88% <0%> (-1.31%) 2% <0%> (ø)
...ernal/operators/flowable/FlowableFromIterable.java 95.18% <0%> (-1.07%) 5% <0%> (ø)
...l/operators/observable/ObservableTimeoutTimed.java 99.15% <0%> (-0.85%) 3% <0%> (ø)
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5ce21f4...cd99d70. Read the comment docs.

@vanniktech
Copy link
Collaborator Author

Addressed your feedback.

* Assert that the TestObserver/TestSubscriber received only the specified values in any order without terminating.
* @param expected the collection of values expected in any order
* @return this;
* @since 2.1.14
Copy link
Member

Choose a reason for hiding this comment

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

Please add - experimental.

* Assert that the TestObserver/TestSubscriber received only the specified values in the specified order without terminating.
* @param sequence the sequence of expected values in order
* @return this;
* @since 2.1.14
Copy link
Member

Choose a reason for hiding this comment

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

Please add - experimental.

@vanniktech
Copy link
Collaborator Author

Whops. Forgot to commit that one, thanks.

@akarnokd akarnokd merged commit 5f1ce20 into ReactiveX:2.x May 18, 2018
@vanniktech vanniktech deleted the assertValueSequenceOnly+assertValueSetOnly branch May 18, 2018 11:15
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