Skip to content

Organize Kotlin tests with @Nested and fix test expectations#913

Merged
timtebeek merged 12 commits intomainfrom
MBoegers/kotlin-tests-nested-organization
Jan 27, 2026
Merged

Organize Kotlin tests with @Nested and fix test expectations#913
timtebeek merged 12 commits intomainfrom
MBoegers/kotlin-tests-nested-organization

Conversation

@MBoegers
Copy link
Contributor

@MBoegers MBoegers commented Jan 26, 2026

Summary

  • This PR builds on top of PR Add kotlin tests #874 by @Laurens-W to add Kotlin tests for Spring recipes. Changes include:

  • Wrap Kotlin tests in @Nested class Kotlin { } as suggested by @timtebeek in review

  • Remove unused import org.openrewrite.Issue from OAuth2ResourceServerLambdaDslTest

  • Fix expected import order in DatabaseComponentAndBeanInitializationOrderingTest

  • Fix expected constructor output (preserves constructor keyword) in NoAutowiredOnConstructorTest

  • Add TypeValidation.none() where Kotlin stdlib types cannot be resolved

Recipe bugs discovered

Some tests have been disabled as they reveal recipe bugs that need separate fixes:

Recipe Bug
OAuth2ResourceServerLambdaDsl Mangles Kotlin code - nests opaqueToken inside jwt and loses jwkSetUri
ImplicitWebAnnotationNames Doesn't add space when removing annotation args from @PathVariable("id")id
DatabaseComponentAndBeanInitializationOrdering Not idempotent for Kotlin - adds annotation again when already present

Related

Test plan

  • All tests pass locally
  • ./gradlew licenseFormat applied

Laurens-W and others added 2 commits December 16, 2025 14:59
Changes:
- Wrap Kotlin tests in @nested class Kotlin { } as suggested by review
- Remove unused import org.openrewrite.Issue from OAuth2ResourceServerLambdaDslTest
- Fix expected import order in DatabaseComponentAndBeanInitializationOrderingTest
- Fix expected constructor output (preserves 'constructor' keyword) in NoAutowiredOnConstructorTest
- Add TypeValidation.none() where Kotlin stdlib types cannot be resolved
- Disable tests that reveal recipe bugs needing separate fixes:
  - OAuth2ResourceServerLambdaDsl mangles Kotlin code structure
  - ImplicitWebAnnotationNames doesn't add space after removing annotation args
  - DatabaseComponentAndBeanInitializationOrdering not idempotent for Kotlin
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Jan 26, 2026
@MBoegers MBoegers marked this pull request as draft January 26, 2026 17:29
Add TypeValidation.none() to OAuth2ResourceServerLambdaDslTest Kotlin
test as the types cannot be fully resolved in CI environment.
@MBoegers
Copy link
Contributor Author

Have to check this:

  • Why TypeValidation.none() is needed
  • Access all test again if they prove the point

@timtebeek timtebeek mentioned this pull request Jan 26, 2026
3 tasks
The recipe has a bug with Kotlin whitespace handling when there is no
space between annotation arguments and the variable name. The test
documents this issue and is marked as @disabled.

When input has space like @PathVariable("id") id, the recipe works
correctly. When input has no space like @PathVariable("id")id, the
recipe does not add the required space.
@MBoegers MBoegers marked this pull request as ready for review January 27, 2026 11:16
MBoegers and others added 3 commits January 27, 2026 12:28
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

Small suggestions to clean this up, but otherwise ok to merge, thanks! Good to see the fix too.

@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Jan 27, 2026
@MBoegers
Copy link
Contributor Author

I have a more complete commit about to push, will merge than

@timtebeek timtebeek merged commit a65d691 into main Jan 27, 2026
2 checks passed
@timtebeek timtebeek deleted the MBoegers/kotlin-tests-nested-organization branch January 27, 2026 13:42
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants