Skip to content

Commit

Permalink
Add test to FindMinimumDependencyVersion finding multiple dependencies
Browse files Browse the repository at this point in the history
This now works as expected since a related fix in rewrite: openrewrite/rewrite@3c314df
  • Loading branch information
pstreef committed Nov 4, 2024
1 parent 2af5151 commit 1dd2ee0
Showing 1 changed file with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,65 @@ void noMatchBecauseVersionIsOutsideRange() {
)
);
}

@Test
void findMultiple() {
rewriteRun(
spec -> spec.recipeFromYaml("""
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.MyRecipe
description: composite recipe finding 2 versions.
recipeList:
- org.openrewrite.java.dependencies.search.FindMinimumDependencyVersion:
groupIdPattern: com.fasterxml.jackson.core
artifactIdPattern: jackson-core
version: 2.14-2.16
- org.openrewrite.java.dependencies.search.FindMinimumDependencyVersion:
groupIdPattern: commons-lang
artifactIdPattern: commons-lang
version: 2.5-2.7
""", "org.openrewrite.MyRecipe"),
//language=xml
pomXml(
"""
<project>
<groupId>org.openrewrite</groupId>
<artifactId>core</artifactId>
<version>0.1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.15.0</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
</project>
""",
"""
<!--~~(com.fasterxml.jackson.core:jackson-core:2.15.0)~~>--><!--~~(commons-lang:commons-lang:2.6)~~>--><project>
<groupId>org.openrewrite</groupId>
<artifactId>core</artifactId>
<version>0.1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.15.0</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
</project>
"""
)
);
}
}

0 comments on commit 1dd2ee0

Please sign in to comment.