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: assertNever(T value) / assertNever(Predicate<T> valuePredicate) #4994

Merged
merged 5 commits into from
Jan 17, 2017

Conversation

sergiomarqmoura
Copy link
Contributor

This pull request adds to any class extending BaseConsumerTest the ability to assert that a given value was not emitted by the observable it was subscribed to, either with assertNever(T value)or assertNever(Predicate<T> valuePredicate)

@codecov-io
Copy link

codecov-io commented Jan 14, 2017

Current coverage is 95.55% (diff: 86.66%)

Merging #4994 into 2.x will increase coverage by 0.02%

@@                2.x      #4994   diff @@
==========================================
  Files           592        592          
  Lines         37969      37989    +20   
  Methods           0          0          
  Messages          0          0          
  Branches       5752       5772    +20   
==========================================
+ Hits          36273      36302    +29   
+ Misses          741        727    -14   
- Partials        955        960     +5   

Powered by Codecov. Last update cd45675...2d6682a

@@ -84,6 +84,58 @@ public void testAssertNotMatchValue() {
}

@Test
public void assertNeverAtNotMatchingValue() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

those tests should also be in TestObserverTest

Copy link
Member

Choose a reason for hiding this comment

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

You have to test when the methods throw becaue the forbidden item is there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@akarnokd look at assertNeverAtMatchingValue() and assertNeverAtMatchingPredicate(). Is that what you mean?

Added the tests to TestObserverTest too.

* @return this;
*/
@SuppressWarnings("unchecked")
public final U assertNever(T value) {
Copy link
Member

Choose a reason for hiding this comment

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

Experimental

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added it

* @return this
*/
@SuppressWarnings("unchecked")
public final U assertNever(Predicate<T> valuePredicate) {
Copy link
Member

Choose a reason for hiding this comment

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

Experimental

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added it

@@ -84,6 +84,58 @@ public void testAssertNotMatchValue() {
}

@Test
public void assertNeverAtNotMatchingValue() {
Copy link
Member

Choose a reason for hiding this comment

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

You have to test when the methods throw becaue the forbidden item is there.

*/
@Experimental
@SuppressWarnings("unchecked")
public final U assertNever(Predicate<T> valuePredicate) {
Copy link
Member

Choose a reason for hiding this comment

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

Predicate<? super T>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

* @param valuePredicate the predicate that receives the onNext value
* and should return true for the expected value.
* @return this
*/
Copy link
Member

Choose a reason for hiding this comment

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

@since 2.0.5 - experimental

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

*
* @param value the value to expect not being received
* @return this;
*/
Copy link
Member

Choose a reason for hiding this comment

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

@since 2.0.5 - experimental

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@akarnokd akarnokd merged commit 9c34eb1 into ReactiveX:2.x Jan 17, 2017
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.

4 participants