|
20 | 20 | import org.openrewrite.test.RecipeSpec; |
21 | 21 | import org.openrewrite.test.RewriteTest; |
22 | 22 |
|
| 23 | +import java.util.regex.Matcher; |
| 24 | +import java.util.regex.Pattern; |
| 25 | + |
| 26 | +import static org.assertj.core.api.Assertions.assertThat; |
23 | 27 | import static org.openrewrite.maven.Assertions.pomXml; |
24 | 28 |
|
25 | 29 | public class JohnzonJavaxtoJakartaTest implements RewriteTest { |
@@ -51,93 +55,33 @@ void migrateJohnzonDependencies() { |
51 | 55 | <artifactId>johnzon-core</artifactId> |
52 | 56 | <version>${johnzon.version}</version> |
53 | 57 | </dependency> |
54 | | - <dependency> |
55 | | - <groupId>org.apache.johnzon</groupId> |
56 | | - <artifactId>johnzon-jaxrs</artifactId> |
57 | | - <version>${johnzon.version}</version> |
58 | | - </dependency> |
59 | | - <dependency> |
60 | | - <groupId>org.apache.johnzon</groupId> |
61 | | - <artifactId>johnzon-jsonb</artifactId> |
62 | | - <version>${johnzon.version}</version> |
63 | | - </dependency> |
64 | | - <dependency> |
65 | | - <groupId>org.apache.johnzon</groupId> |
66 | | - <artifactId>johnzon-jsonb-extras</artifactId> |
67 | | - <version>${johnzon.version}</version> |
68 | | - </dependency> |
69 | | - <dependency> |
70 | | - <groupId>org.apache.johnzon</groupId> |
71 | | - <artifactId>johnzon-jsonschema</artifactId> |
72 | | - <version>${johnzon.version}</version> |
73 | | - </dependency> |
74 | | - <dependency> |
75 | | - <groupId>org.apache.johnzon</groupId> |
76 | | - <artifactId>johnzon-mapper</artifactId> |
77 | | - <version>${johnzon.version}</version> |
78 | | - </dependency> |
79 | | - <dependency> |
80 | | - <groupId>org.apache.johnzon</groupId> |
81 | | - <artifactId>johnzon-websocket</artifactId> |
82 | | - <version>${johnzon.version}</version> |
83 | | - </dependency> |
84 | 58 | </dependencies> |
85 | 59 | </project> |
86 | 60 | """, |
87 | | - """ |
88 | | - <project> |
89 | | - <groupId>com.example.ehcache</groupId> |
90 | | - <artifactId>johnzon-legacy</artifactId> |
91 | | - <version>1.0.0</version> |
92 | | - <properties> |
93 | | - <johnzon.version>1.2.19</johnzon.version> |
94 | | - </properties> |
95 | | - <dependencies> |
96 | | - <dependency> |
97 | | - <groupId>org.apache.johnzon</groupId> |
98 | | - <artifactId>johnzon-core</artifactId> |
99 | | - <version>${johnzon.version}</version> |
100 | | - <classifier>jakarta</classifier> |
101 | | - </dependency> |
102 | | - <dependency> |
103 | | - <groupId>org.apache.johnzon</groupId> |
104 | | - <artifactId>johnzon-jaxrs</artifactId> |
105 | | - <version>${johnzon.version}</version> |
106 | | - <classifier>jakarta</classifier> |
107 | | - </dependency> |
108 | | - <dependency> |
109 | | - <groupId>org.apache.johnzon</groupId> |
110 | | - <artifactId>johnzon-jsonb</artifactId> |
111 | | - <version>${johnzon.version}</version> |
112 | | - <classifier>jakarta</classifier> |
113 | | - </dependency> |
114 | | - <dependency> |
115 | | - <groupId>org.apache.johnzon</groupId> |
116 | | - <artifactId>johnzon-jsonb-extras</artifactId> |
117 | | - <version>${johnzon.version}</version> |
118 | | - <classifier>jakarta</classifier> |
119 | | - </dependency> |
120 | | - <dependency> |
121 | | - <groupId>org.apache.johnzon</groupId> |
122 | | - <artifactId>johnzon-jsonschema</artifactId> |
123 | | - <version>${johnzon.version}</version> |
124 | | - <classifier>jakarta</classifier> |
125 | | - </dependency> |
126 | | - <dependency> |
127 | | - <groupId>org.apache.johnzon</groupId> |
128 | | - <artifactId>johnzon-mapper</artifactId> |
129 | | - <version>${johnzon.version}</version> |
130 | | - <classifier>jakarta</classifier> |
131 | | - </dependency> |
132 | | - <dependency> |
133 | | - <groupId>org.apache.johnzon</groupId> |
134 | | - <artifactId>johnzon-websocket</artifactId> |
135 | | - <version>${johnzon.version}</version> |
136 | | - <classifier>jakarta</classifier> |
137 | | - </dependency> |
138 | | - </dependencies> |
139 | | - </project> |
140 | | - """ |
| 61 | + spec -> spec.after(actual -> { |
| 62 | + assertThat(actual).isNotNull(); |
| 63 | + Matcher version = Pattern.compile("<johnzon.version>([0-9]+\\.[0-9]+\\.[0-9]+)</johnzon.version>") |
| 64 | + .matcher(actual); |
| 65 | + assertThat(version.find()).isTrue(); |
| 66 | + return """ |
| 67 | + <project> |
| 68 | + <groupId>com.example.ehcache</groupId> |
| 69 | + <artifactId>johnzon-legacy</artifactId> |
| 70 | + <version>1.0.0</version> |
| 71 | + <properties> |
| 72 | + <johnzon.version>%s</johnzon.version> |
| 73 | + </properties> |
| 74 | + <dependencies> |
| 75 | + <dependency> |
| 76 | + <groupId>org.apache.johnzon</groupId> |
| 77 | + <artifactId>johnzon-core</artifactId> |
| 78 | + <version>${johnzon.version}</version> |
| 79 | + <classifier>jakarta</classifier> |
| 80 | + </dependency> |
| 81 | + </dependencies> |
| 82 | + </project> |
| 83 | + """.formatted(version.group(1)); |
| 84 | + }) |
141 | 85 | ) |
142 | 86 | ); |
143 | 87 | } |
|
0 commit comments