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

1.x: add TestSubscriber.assertValuesAndClear #4322

Merged
merged 4 commits into from
Aug 11, 2016

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented Aug 9, 2016

This PR adds an assertAndConsume assertValuesAndClear method to TestSubscriber 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 in assertValues.

On a sidenote, getOnNextEvents() returns the internal list and one can call clear() on it.

@codecov-io
Copy link

codecov-io commented Aug 9, 2016

Current coverage is 84.31% (diff: 80.00%)

Merging #4322 into 1.x will decrease coverage by 0.15%

@@                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   

Powered by Codecov. Last update b3a0446...7fc11a3


try {
ts.assertAndConsume(4, 5, 6);
Assert.fail("Should have thrown AssertionError");
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: static import

Copy link
Member Author

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.

Copy link
Contributor

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

@artem-zinnatullin
Copy link
Contributor

👍 but method name, I just can't treat it as good for this API

@artem-zinnatullin
Copy link
Contributor

👍

@akarnokd akarnokd changed the title 1.x: add TestSubscriber.assertAndConsume 1.x: add TestSubscriber.assertValuesAndClear Aug 10, 2016
@artem-zinnatullin
Copy link
Contributor

@JakeWharton / @zsxwing / @vanniktech can you PTAL? Would be great if we could include it in 1.1.9.

@akarnokd akarnokd merged commit 9074410 into ReactiveX:1.x Aug 11, 2016
@akarnokd akarnokd deleted the TestAssertConsume branch August 11, 2016 11:59
@JakeWharton
Copy link
Contributor

Old method name was better

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.

None yet

4 participants