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 TestSubscriber.withTag #5137

Merged
merged 1 commit into from
Feb 27, 2017
Merged

Conversation

akarnokd
Copy link
Member

This PR adds the method withTag to the TestBaseConsumer that allows setting a textual tag which is then appended to the assertion failure's message:

Failure message (latch = 1, values = 0, errors = 0, completions = 0, tag = x: 5, y: 7)

Use case, for example, is to add the parameters of the current flow to help identify what settings caused the failure. This comes up with unit tests that have some form of (nested) loop(s) to verify multiple parameter ranges. (It is often much easier than trying to work out JUnit rules and such.)

@codecov
Copy link

codecov bot commented Feb 25, 2017

Codecov Report

Merging #5137 into 2.x will decrease coverage by -0.11%.
The diff coverage is 100%.

@@             Coverage Diff              @@
##                2.x    #5137      +/-   ##
============================================
- Coverage     95.96%   95.86%   -0.11%     
+ Complexity     5611     5600      -11     
============================================
  Files           620      620              
  Lines         39820    39826       +6     
  Branches       5599     5600       +1     
============================================
- Hits          38215    38180      -35     
- Misses          633      662      +29     
- Partials        972      984      +12
Impacted Files Coverage Δ Complexity Δ
.../java/io/reactivex/observers/BaseTestConsumer.java 98.04% <100%> (+0.05%) 93 <1> (+2)
...rnal/subscribers/SinglePostCompleteSubscriber.java 87.17% <ø> (-12.83%) 13% <ø> (-2%)
...ternal/operators/flowable/FlowableSampleTimed.java 88.23% <ø> (-8.83%) 3% <ø> (ø)
...a/io/reactivex/processors/SerializedProcessor.java 89.36% <ø> (-8.52%) 26% <ø> (-2%)
.../internal/operators/maybe/MaybeTakeUntilMaybe.java 93.87% <ø> (-6.13%) 2% <ø> (ø)
...in/java/io/reactivex/subjects/BehaviorSubject.java 84.97% <ø> (-5.7%) 56% <ø> (ø)
...ternal/operators/flowable/FlowableSubscribeOn.java 90.9% <ø> (-5.46%) 2% <ø> (ø)
...rnal/subscriptions/DeferredScalarSubscription.java 93.84% <ø> (-4.62%) 27% <ø> (-1%)
...reactivex/internal/operators/single/SingleAmb.java 96.36% <ø> (-3.64%) 9% <ø> (-1%)
...vex/internal/operators/single/SingleTakeUntil.java 91.8% <ø> (-3.28%) 2% <ø> (ø)
... and 44 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 a03bf90...8dfe4ce. Read the comment docs.

Copy link
Collaborator

@vanniktech vanniktech left a comment

Choose a reason for hiding this comment

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

I like

@akarnokd akarnokd merged commit 3356444 into ReactiveX:2.x Feb 27, 2017
@akarnokd akarnokd deleted the BaseTestConsumerTag branch February 27, 2017 16:45
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.

3 participants