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

3.x: Improve error messages in the test consumers #7126

Merged
merged 2 commits into from
Dec 6, 2020

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented Dec 6, 2020

This PR improves the error messages reported in the TestObserver and TestSubscriber:

  • assertValue(Predicate) now shows the value that didn't pass the predicate
  • assertValueAt(index, T):
    • If the index is out of range, the message includes the valid range
    • the message now includes the index argument where the failure happened
  • assertValueAt(index, Predicate):
    • If the index is out of range, the message includes the valid range
    • shows the value at index that didn't pass the predicate
    • the message now includes the index argument where the failure happened
  • assertError(Predicate) is now worded to indicate the exception did not pass the predicate

In addition, the verification tests for the error messages were not actually testing the error message with assertThrows and have been updated.

Resolves #7125

@akarnokd akarnokd added this to the 3.1 milestone Dec 6, 2020
@codecov
Copy link

codecov bot commented Dec 6, 2020

Codecov Report

Merging #7126 (8ceb70f) into 3.x (67c1a36) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##                3.x    #7126      +/-   ##
============================================
- Coverage     99.57%   99.55%   -0.02%     
- Complexity     6671     6673       +2     
============================================
  Files           742      742              
  Lines         47267    47273       +6     
  Branches       6374     6376       +2     
============================================
- Hits          47066    47064       -2     
- Misses           89       94       +5     
- Partials        112      115       +3     
Impacted Files Coverage Δ Complexity Δ
.../reactivex/rxjava3/observers/BaseTestConsumer.java 100.00% <100.00%> (ø) 75.00 <3.00> (+5.00)
...tivex/rxjava3/internal/jdk8/ParallelCollector.java 94.49% <0.00%> (-3.67%) 2.00% <0.00%> (ø%)
...x/rxjava3/internal/operators/single/SingleAmb.java 96.61% <0.00%> (-3.39%) 9.00% <0.00%> (-1.00%)
...xjava3/internal/observers/FutureMultiObserver.java 96.61% <0.00%> (-3.39%) 27.00% <0.00%> (-1.00%)
...vex/rxjava3/internal/operators/maybe/MaybeAmb.java 96.96% <0.00%> (-3.04%) 10.00% <0.00%> (-1.00%)
...nternal/operators/parallel/ParallelReduceFull.java 91.08% <0.00%> (-1.99%) 2.00% <0.00%> (ø%)
...nternal/operators/observable/ObservableWindow.java 98.21% <0.00%> (-1.79%) 3.00% <0.00%> (ø%)
...nternal/operators/parallel/ParallelSortedJoin.java 98.49% <0.00%> (-1.51%) 2.00% <0.00%> (ø%)
.../operators/observable/ObservableCombineLatest.java 99.38% <0.00%> (-0.62%) 6.00% <0.00%> (ø%)
...a/io/reactivex/rxjava3/subjects/ReplaySubject.java 98.75% <0.00%> (-0.42%) 49.00% <0.00%> (ø%)
... and 6 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 67c1a36...8ceb70f. Read the comment docs.

@akarnokd akarnokd merged commit 7e7b223 into ReactiveX:3.x Dec 6, 2020
@akarnokd akarnokd deleted the TestConsumerReportImprovements branch December 6, 2020 21:33
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.

TestObserver error messages should include more information about values where possible
2 participants