-
Notifications
You must be signed in to change notification settings - Fork 39
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
Extend JUnitToAssertJRules
Refaster rule collection
#1484
base: master
Are you sure you want to change the base?
Conversation
By migrating all remaining `assertArrayEquals` methods.
Looks good. No mutations were possible for these changes. |
Quality Gate passedIssues Measures |
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 👍
@AfterTemplate | ||
@UseImportPolicy(STATIC_IMPORT_ALWAYS) | ||
void after(boolean[] actual, String message, boolean[] expected) { | ||
assertThat(actual).withFailMessage(message).containsExactly(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.
I wanted to suggest the following to make the style consistent with AssertJThrowingCallableRules
where we do the message assertion after the checking the expected value.
assertThat(actual).withFailMessage(message).containsExactly(expected); | |
assertThat(actual).containsExactly(expected).withFailMessage(message); |
But Intellij warns Result of 'AbstractAssert. withFailMessage()' is ignored
; which I think is because of @CheckReturnValue
annotation.
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.
Yep, see also the Javadoc of AbstractAssert#withFailMessage
:
* You must set the message <b>before</b> calling the assertion otherwise it is ignored as the failing assertion breaks
* the call chain by throwing an {@link AssertionError}.
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.
That makes more sense 😄
Validated that these changes do not impact the integration tests. |
Suggested commit message:
Analogous to #1483, this is me putting up a PR for a existing branch, this time after extending the work with the help of GitHub Copilot. (Also here, perhaps an Error Prone check is in order, but not today.)