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: fix assertValueSequence reversed error message #5594
Conversation
Codecov Report
@@ Coverage Diff @@
## 2.x #5594 +/- ##
============================================
- Coverage 96.23% 96.22% -0.02%
- Complexity 5826 5827 +1
============================================
Files 632 632
Lines 41467 41467
Branches 5745 5745
============================================
- Hits 39906 39900 -6
- Misses 613 620 +7
+ Partials 948 947 -1
Continue to review full report at Codecov.
|
@@ -958,13 +958,15 @@ public void assertValueSequence() { | |||
throw new RuntimeException("Should have thrown"); | |||
} catch (AssertionError ex) { | |||
// expected |
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.
let's remove this then?
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.
I say let's keep it to indicate catching te AssertionError is not an accident.
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.
Usually that's done by naming exception as expected
:
try {
// …
fail();
} catch (AssertionError expected) {
// Assert exception message, etc.
}
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.
Fine.
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.
LGTM, but one more test pls
@@ -958,13 +958,15 @@ public void assertValueSequence() { | |||
throw new RuntimeException("Should have thrown"); | |||
} catch (AssertionError ex) { | |||
// expected |
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.
Usually that's done by naming exception as expected
:
try {
// …
fail();
} catch (AssertionError expected) {
// Assert exception message, etc.
}
|
||
if (!ObjectHelper.equals(u, v)) { | ||
throw fail("Values at position " + i + " differ; Expected: " + valueAndClass(u) + ", Actual: " + valueAndClass(v)); | ||
throw fail("Values at position " + i + " differ; Expected: " + valueAndClass(v) + ", Actual: " + valueAndClass(u)); |
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.
This change also needs a test
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.
There is no behavior change here, just a swapped variable name. I'll restore the original u - expected, v - actual naming
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.
Ah. Well at least we have a valid reason to start working on RxJava 3 — kill these one-letter variable names
The error message/variable names in
TestBaseConsumer.assertValueSequence
was reversed: if more items were expected, it said "Fewer" and vice versa.