8000 Migration Tool - Fix UpdateAsserts rewrite. by lhanusov · Pull Request #47512 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Migration Tool - Fix UpdateAsserts rewrite. - #47512

Closed
lhanusov wants to merge 1 commit into
keycloak:mainfrom
lhanusov:origin/37283/migration-tool_assertfix
Closed

lhanusov wants to merge 1 commit into
keycloak:mainfrom
lhanusov:origin/37283/migration-tool_assertfix

Conversation

@lhanusov
@lhanusov lhanusov commented Mar 27, 2026 •
Copy link
Copy Markdown
Contributor

The migration tool matches "Assert.assertEquals" pattern, to switch the position of a message, due to a change in JUnit5. If there is a static import of assertEquals, it doesn't recognize it. This issue will fix it.

import static org.junit.Assert.assertEquals;

assertEquals("message", 0, 1);

@lhanusov
lhanusov requested a review from a team as a code owner March 27, 2026 09:07
Signed-off-by: Lukas Hanusovsky <lhanusov@redhat.com>
@lhanusov
lhanusov force-pushed the origin/37283/migration-tool_assertfix branch from 56ae2d1 to fd3b23c Compare March 27, 2026 09:24
@lhanusov lhanusov mentioned this pull request Mar 30, 2026
1 of 10 tasks
@lhanusov lhanusov added the area/test-framework Test framework — infrastructure, Realm DSL, page objects, migration utils label Apr 1, 2026
@lhanusov lhanusov self-assigned this Apr 1, 2026
@lhanusov
lhanusov requested a review from stianst April 1, 2026 13:12
@stianst
stianst commented Apr 9, 2026
Copy link
Copy Markdown
Contributor

This PR fix the condition, when line is checked for the Assert prefix. It adds static methods recognition as well:

import static org.junit.Assert.assertEquals;

assertEquals("message", 0, 1);

What do you mean by This PR fix the condition, when line is checked for the Assert prefix?

@stianst
stianst commented Apr 9, 2026
Copy link
Copy Markdown
Contributor

Wonder if we should consider using OpenRewrite for some stuff. For example assertions:
https://docs.openrewrite.org/recipes/java/testing/junit5/asserttoassertions

@lhanusov
Copy link
Copy Markdown
Contributor Author

will be probably solved by: #47893

@stianst
stianst commented Apr 10, 2026
Copy link
Copy Markdown
Contributor

We'll update old testsuite to use assertions instead

@stianst stianst closed this Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/test-framework Test framework — infrastructure, Realm DSL, page objects, migration utils

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0