-
Notifications
You must be signed in to change notification settings - Fork 1k
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
GitHub 2913 #2914
GitHub 2913 #2914
Conversation
/* expected */ | ||
} | ||
if (succeeded) { | ||
Assert.fail("Maps reported as not equal when equal: " + m1 + " / " + m2); |
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.
Could be replaced but assertFalse
assertEquals(m1, m2); | ||
|
||
boolean succeeded = false; | ||
try { |
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.
can we refactor this to
try {
assertNotEquals((Object) m1, (Object) m2);
Assert.fail("Maps reported as not equal when equal: " + m1 + " / " + m2);
} catch (AssertionError ignored) {}
This will do away with the extra variable succeeded
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 like the var name instead of the comment -- I've called it expected
.
However putting the Assert.fail
call inside the try
will cause the AssertionError
that it throws to be ignored, won't it?, and that defeats the point of the test. I don't know of a simple way to avoid the ugly succeeded
, apart from introducing lambdas or splitting up the test and using expectedExceptions
or checking the body of the failure message -- all of which I think are worse. (But I don't feel at strongly and this is your codebase so LMK if you prefer something different!)
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.
(gradle insists on putting a newline between the {}
but it saves a bit of bloat)
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 can try {} //
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.
@ahgittin - Sigh! my bad. Yes you are correct.
CHANGES.txt
Outdated
@@ -1,5 +1,7 @@ | |||
Current | |||
|
|||
Fixed: GITHUB-2913: Maps containing nulls can be incorrectly considered equal |
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.
@ahgittin It would be good if you could please help add your ID/name at the end of this line, so that we can call out your contribution in the release notes of this version (when it goes out). Its our small way of thanking you for helping TestNG become better.
All applied - TY |
Fixes #2913 .
Did you remember to?
CHANGES.txt
./gradlew autostyleApply