-
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
2.x: assertNever(T value) / assertNever(Predicate<T> valuePredicate) #4994
Conversation
Current coverage is 95.55% (diff: 86.66%)@@ 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
|
@@ -84,6 +84,58 @@ public void testAssertNotMatchValue() { | |||
} | |||
|
|||
@Test | |||
public void assertNeverAtNotMatchingValue() { |
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.
those tests should also be in TestObserverTest
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.
You have to test when the methods throw becaue the forbidden item is there.
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.
@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) { |
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.
Experimental
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.
Added it
* @return this | ||
*/ | ||
@SuppressWarnings("unchecked") | ||
public final U assertNever(Predicate<T> valuePredicate) { |
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.
Experimental
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.
Added it
@@ -84,6 +84,58 @@ public void testAssertNotMatchValue() { | |||
} | |||
|
|||
@Test | |||
public void assertNeverAtNotMatchingValue() { |
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.
You have to test when the methods throw becaue the forbidden item is there.
*/ | ||
@Experimental | ||
@SuppressWarnings("unchecked") | ||
public final U assertNever(Predicate<T> valuePredicate) { |
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.
Predicate<? super T>
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.
Done
* @param valuePredicate the predicate that receives the onNext value | ||
* and should return true for the expected value. | ||
* @return this | ||
*/ |
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.
@since 2.0.5 - experimental
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.
Done
* | ||
* @param value the value to expect not being received | ||
* @return this; | ||
*/ |
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.
@since 2.0.5 - experimental
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.
Done
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 withassertNever(T value)
orassertNever(Predicate<T> valuePredicate)