-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
1.x: add TestSubscriber.assertValuesAndClear #4322
Conversation
Current coverage is 84.31% (diff: 80.00%)@@ 1.x #4322 diff @@
==========================================
Files 268 270 +2
Lines 17478 17517 +39
Methods 0 0
Messages 0 0
Branches 2664 2678 +14
==========================================
+ Hits 14764 14770 +6
- Misses 1853 1892 +39
+ Partials 861 855 -6
|
|
||
try { | ||
ts.assertAndConsume(4, 5, 6); | ||
Assert.fail("Should have thrown AssertionError"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: static import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does IntelliJ do that automatically? Eclipse doesn't so I have to go and manually type in the import; writing out Assert
is more convenient for me. If you want, you can turn all of these into static imports in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In IntelliJ I usually just write fail(
and hit ALT + ENTER
to apply static import, IntellIJ applies it for whole file then
👍 but method name, I just can't treat it as good for this API |
👍 |
@JakeWharton / @zsxwing / @vanniktech can you PTAL? Would be great if we could include it in 1.1.9. |
Old method name was better |
This PR adds an
assertAndConsume
assertValuesAndClear
method toTestSubscriber
to assert on value content and then clear the internal value list. This helps asserting on received values without the need to list all previously seen values inassertValues
.On a sidenote,
getOnNextEvents()
returns the internal list and one can callclear()
on it.