Skip to content

Conversation

@jc65536
Copy link
Contributor

@jc65536 jc65536 commented Nov 4, 2025

What's changed?

Added a recipe to add Testcontainers JUnit 5 annotations, including unit tests

What's your motivation?

Anything in particular you'd like reviewers to focus on?

I'm having trouble with the JavaParser not being able to load testcontainers from the class path. See AddTestcontainersAnnotations.java lines 60-69 and AddTestcontainersAnnotationsTest.java line 28-32.

Anyone you would like to review specifically?

Have you considered any alternatives or workarounds?

Any additional context

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Nov 4, 2025
@jc65536 jc65536 marked this pull request as draft November 4, 2025 22:47
@jc65536 jc65536 changed the title Draft: Add recipe to add Testcontainers JUnit 5 annotations Add recipe to add Testcontainers JUnit 5 annotations Nov 4, 2025
@timtebeek timtebeek marked this pull request as ready for review November 10, 2025 20:28
@timtebeek timtebeek self-requested a review November 10, 2025 20:28
@timtebeek timtebeek changed the title Add recipe to add Testcontainers JUnit 5 annotations Convert Testcontainers @Rule/@ClassRule to JUnit 5 @Container and add @Testcontainers Nov 10, 2025
Copy link
Member

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the help here @jc65536 !

@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Nov 10, 2025
@timtebeek timtebeek merged commit 1bec70c into openrewrite:main Nov 10, 2025
2 checks passed
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Nov 10, 2025
@jc65536
Copy link
Contributor Author

jc65536 commented Nov 10, 2025

Thanks @timtebeek for your guidance + cleaning the code up!

mergify bot added a commit to robfrank/linklift that referenced this pull request Nov 16, 2025
…rom 3.21.2 to 3.21.3 [skip ci]

[//]: # (dependabot-start)
⚠️ \*\*Dependabot is rebasing this PR\*\* ⚠️
Rebasing might not happen immediately, so don't worry if this takes some time.
Note: if you make any changes to this PR yourself, they will take precedence over the rebase.
---
[//]: # (dependabot-end)
Bumps [org.openrewrite.recipe:rewrite-testing-frameworks](https://github.com/openrewrite/rewrite-testing-frameworks) from 3.21.2 to 3.21.3.
Release notes

*Sourced from [org.openrewrite.recipe:rewrite-testing-frameworks's releases](https://github.com/openrewrite/rewrite-testing-frameworks/releases).*

> v3.21.3
> -------
>
> What's Changed
> --------------
>
> * fix: add Mockito.anyObject() alias to Mockito 1-to-3 migration by [`@​rshvashisht`](https://github.com/rshvashisht) in [openrewrite/rewrite-testing-frameworks#842](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/pull/842)
> * Add `guava-33` type table entry for `AssertJIterableRulesRecipes` from EPS by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-testing-frameworks#843](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/pull/843)
> * Convert Testcontainers `@Rule`/`@ClassRule` to JUnit 5 `@Container` and add `@Testcontainers` by [`@​jc65536`](https://github.com/jc65536) in [openrewrite/rewrite-testing-frameworks#838](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/pull/838)
>
> New Contributors
> ----------------
>
> * [`@​rshvashisht`](https://github.com/rshvashisht) made their first contribution in [openrewrite/rewrite-testing-frameworks#842](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/pull/842)
> * [`@​jc65536`](https://github.com/jc65536) made their first contribution in [openrewrite/rewrite-testing-frameworks#838](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/pull/838)
>
> **Full Changelog**: <openrewrite/rewrite-testing-frameworks@v3.21.2...v3.21.3>


Commits

* [`2f1d974`](openrewrite/rewrite-testing-frameworks@2f1d974) OpenRewrite recipe best practices
* [`1bec70c`](openrewrite/rewrite-testing-frameworks@1bec70c) Convert Testcontainers `@Rule`/`@ClassRule` to JUnit 5 `@Container` and add `...
* [`5f01caa`](openrewrite/rewrite-testing-frameworks@5f01caa) Add `guava-33` type table entry for `AssertJIterableRulesRecipes` from EPS (#...
* [`cf5ba29`](openrewrite/rewrite-testing-frameworks@cf5ba29) fix: add Mockito.anyObject() alias to Mockito 1-to-3 migration ([#842](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/issues/842))
* See full diff in [compare view](openrewrite/rewrite-testing-frameworks@v3.21.2...v3.21.3)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=org.openrewrite.recipe:rewrite-testing-frameworks&package-manager=maven&previous-version=3.21.2&new-version=3.21.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add recipe to migrate Testcontainers as part of JUnit 4 to 5 migration

2 participants