Skip to content

Correct shared JUnit annotations and rule type matching - #1191

Open
hugoncosta wants to merge 1 commit into
openrewrite:mainfrom
hugoncosta:fix/junit-shared-annotations-and-rules
Open

hugoncosta wants to merge 1 commit into
openrewrite:mainfrom
hugoncosta:fix/junit-shared-annotations-and-rules

Conversation

@hugoncosta

@hugoncosta hugoncosta commented Oct 14, 2026 •

Copy link
Copy Markdown

What's changed?

Extract the shared Java annotation and rule corrections from #1189.

  • Omit @Timeout for an explicit JUnit 4 timeout = 0.
  • Use the concrete MethodOrderer.MethodName template import and retain the generated import.
  • Convert WireMock @ClassRule fields to static registered extensions and keep renamed port method types consistent.
  • Preserve simple nested category names when reading attributed types.
  • Match rule variables using their actual types, including declarations whose type expression is unavailable.

Add named regression cases for zero timeout, static WireMock registration and nested category names. No new Kotlin visitor, dependency, public recipe or test harness is included.

What's your motivation?

These shared corrections affect Java recipes and deserve a review separate from Kotlin structural migrations, as requested in #1189.

Verification

  • All 80 targeted tests pass on this branch across the ten affected recipe test classes.
  • One commit directly above upstream main, independent of the setup PR.
  • git diff --check passes.
  • Public recipe names, descriptions and composition are unchanged, so no catalog update is needed.

Local verification used public build plugin 2.23.0 / Rewrite 8.90.4 through an uncommitted build override. The repository's default build still requires CI verification.

Related: #1188, #1189. This is the second of the planned smaller contributions; it does not close the Kotlin parity issue.

Companion split: #1190. Both PRs are independently based on upstream main.

Drop explicit zero timeouts, use a resolvable MethodOrderer.MethodName import,
register static WireMock class rules, and retain simple nested category names.
Use named variable types for rule matching, including inferred declarations.
Keep these Java-affecting fixes separate from Kotlin source migration.
@timtebeek
timtebeek force-pushed the fix/junit-shared-annotations-and-rules branch from 979afb1 to d5fdb18 Compare November 18, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant