diff --git a/rewrite-maven/src/test/java/org/openrewrite/maven/RemoveDuplicateDependenciesTest.java b/rewrite-maven/src/test/java/org/openrewrite/maven/RemoveDuplicateDependenciesTest.java index cb019d1d71..0e6877e8ba 100644 --- a/rewrite-maven/src/test/java/org/openrewrite/maven/RemoveDuplicateDependenciesTest.java +++ b/rewrite-maven/src/test/java/org/openrewrite/maven/RemoveDuplicateDependenciesTest.java @@ -15,6 +15,7 @@ */ package org.openrewrite.maven; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.openrewrite.DocumentExample; import org.openrewrite.Issue; @@ -409,6 +410,56 @@ void keepDependencyWithDifferentScope() { ); } + @Disabled("DependencyKey includes scope, so declarations differing only in scope are not detected, though Maven resolves them to one dependency; the existing keepDependencyWithDifferentScope test pins the opposite outcome, so a fix must change that expectation too") + @Test + void removeDuplicatedDependencyDifferingOnlyInScope() { + rewriteRun( + pomXml( + """ + + 4.0.0 + + com.mycompany.app + my-app + 1 + + + + junit + junit + 4.13.1 + + + junit + junit + 4.13.1 + test + + + + """, + """ + + 4.0.0 + + com.mycompany.app + my-app + 1 + + + + junit + junit + 4.13.1 + test + + + + """ + ) + ); + } + @Test void removeDuplicatedDependencyWithImportScope() { rewriteRun(