Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/main/resources/META-INF/rewrite/junit5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ recipeList:
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.testing.junit5.ExcludeJUnit4UnlessUsingTestcontainers
displayName: Exclude JUnit 4, unless Spring Boot Testcontainers is used
description: Excludes JUnit 4, as it ought not to be necessary in a JUnit 5 project, unless Testcontainers 1.x is used.
displayName: Exclude JUnit 4, unless Testcontainers is used
description: Excludes JUnit 4, as it ought not to be necessary in a JUnit 5 project, unless Testcontainers is used.
preconditions:
- org.openrewrite.maven.search.DoesNotIncludeDependency:
groupId: org.springframework.boot
artifactId: spring-boot-testcontainers
groupId: org.testcontainers
artifactId: '*'
version: 1.x
recipeList:
- org.openrewrite.java.testing.testcontainers.Testcontainers2Migration
- org.openrewrite.maven.ExcludeDependency:
groupId: junit
artifactId: junit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,11 @@ void excludeJunit4Dependency() {
}

@Issue("https://github.com/openrewrite/rewrite-testing-frameworks/issues/429")
@Issue("https://github.com/openrewrite/rewrite-testing-frameworks/issues/850")
@Test
void dontExcludeJunit4DependencyFromTestcontainers() {
rewriteRun(
// No changes expected when Testcontainers is present - JUnit 4 should not be excluded
pomXml(
//language=xml
"""
Expand All @@ -249,19 +251,17 @@ void dontExcludeJunit4DependencyFromTestcontainers() {
</dependency>
</dependencies>
</project>
""",
spec -> spec.after(pom -> assertThat(pom)
.containsPattern("2.\\d+\\.\\d+")
.doesNotContain("<exclusions>")
.actual())
"""
)
);
}

@Issue("https://github.com/openrewrite/rewrite-testing-frameworks/issues/429")
@Issue("https://github.com/openrewrite/rewrite-testing-frameworks/issues/850")
@Test
void dontExcludeJunit4DependencyFromTestcontainersJupiter() {
rewriteRun(
// No changes expected when Testcontainers is present - JUnit 4 should not be excluded
pomXml(
//language=xml
"""
Expand All @@ -279,13 +279,7 @@ void dontExcludeJunit4DependencyFromTestcontainersJupiter() {
</dependency>
</dependencies>
</project>
""",
spec -> spec.after(pom -> assertThat(pom)
.contains("testcontainers-junit-jupiter")
.containsPattern("2.\\d+\\.\\d+")
.doesNotContain(">junit-jupiter")
.doesNotContain("<exclusions>")
.actual())
"""
)
);
}
Expand Down