Skip to content

Commit

Permalink
[55] Use recursive: true on ChangePackage for coll3->4 recipe (#56)
Browse files Browse the repository at this point in the history
#55

Co-authored-by: Samuel Cox <[email protected]>
  • Loading branch information
crankydillo and Samuel Cox authored Jan 31, 2025
1 parent 9baaaba commit f810765
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.apache.commons.collections.UpgradeApacheCommonsCollections_3_4
displayName: Migrates to Apache Commons Collections 4.x
description: >-
Migrate applications to the latest Apache Commons Collections 4.x release. This recipe modifies
Migrate applications to the latest Apache Commons Collections 4.x release. This recipe modifies
application's build files, make changes to deprecated/preferred APIs, and migrates configuration settings that have
changes between versions.
tags:
Expand Down Expand Up @@ -54,3 +54,4 @@ recipeList:
- org.openrewrite.java.ChangePackage:
oldPackageName: org.apache.commons.collections
newPackageName: org.apache.commons.collections4
recursive: true
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
import org.openrewrite.Issue;
import org.openrewrite.java.JavaParser;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;
Expand Down Expand Up @@ -81,4 +82,22 @@ static void helloApacheCollections() {
)
);
}

@Test
@Issue("https://github.com/openrewrite/rewrite-apache/issues/55")
void hashedMap() {
rewriteRun(
//language=java
java(
"""
import org.apache.commons.collections.map.HashedMap;
class Test {}
""",
"""
import org.apache.commons.collections4.map.HashedMap;
class Test {}
"""
)
);
}
}

0 comments on commit f810765

Please sign in to comment.