Skip to content

Conversation

@Laurens-W
Copy link
Contributor

What's changed?

Added Kotlin based tests to validate these recipes work

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

@Laurens-W Laurens-W requested a review from timtebeek December 16, 2025 14:03
@Laurens-W Laurens-W self-assigned this Dec 16, 2025
@Laurens-W Laurens-W added the bug Something isn't working label Dec 16, 2025
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Dec 16, 2025
Comment on lines +606 to +632
@Test
void shouldRemoveAutowiredFromKotlinPrimaryConstructor() {
//language=kotlin
rewriteRun(
kotlin(
"""
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
@Service
class MyService @Autowired constructor(
private val dependency: String
)
""",
"""
import org.springframework.stereotype.Service
@Service
class MyService(
private val dependency: String
)
"""
)
);
}

@Test
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@Test
void shouldRemoveAutowiredFromKotlinPrimaryConstructor() {
//language=kotlin
rewriteRun(
kotlin(
"""
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
@Service
class MyService @Autowired constructor(
private val dependency: String
)
""",
"""
import org.springframework.stereotype.Service
@Service
class MyService(
private val dependency: String
)
"""
)
);
}
@Test
@Test

Comment on lines +22 to 23
import org.openrewrite.Issue;
import org.openrewrite.java.JavaParser;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
import org.openrewrite.Issue;
import org.openrewrite.java.JavaParser;
import org.openrewrite.java.JavaParser;

Comment on lines +188 to +190

@Test
void removeUnnecessaryAnnotationArgumentKotlin() {
Copy link
Member

Choose a reason for hiding this comment

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

Might it make sense to add the Kotlin tests in a @Nested class Kotlin { ... } ? That way it's clear they might mimic coverage for a specific purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants