Skip to content

Commit 4a7a707

Browse files
committed
Add test for removing jws-api for EE10 recipe
1 parent c1aabd0 commit 4a7a707

1 file changed

Lines changed: 90 additions & 0 deletions

File tree

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
* Copyright 2025 the original author or authors.
3+
* <p>
4+
* Licensed under the Moderne Source Available License (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* <p>
8+
* https://docs.moderne.io/licensing/moderne-source-available-license
9+
* <p>
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.openrewrite.java.migrate.jakarta;
17+
18+
import org.junit.jupiter.api.Test;
19+
import org.openrewrite.DocumentExample;
20+
import org.openrewrite.test.RecipeSpec;
21+
import org.openrewrite.test.RewriteTest;
22+
23+
import static org.assertj.core.api.Assertions.assertThat;
24+
import static org.openrewrite.maven.Assertions.pomXml;
25+
26+
class ReplaceJakartaJwsWithJakartaXmlWsTest implements RewriteTest {
27+
28+
@Override
29+
public void defaults(RecipeSpec spec) {
30+
spec.recipeFromResources("org.openrewrite.java.migrate.jakarta.ReplaceJakartaJwsWithJakartaXmlWs");
31+
}
32+
33+
@DocumentExample
34+
@Test
35+
void removesJakartaJwsApiAndAddsJakartaXmlWsApi() {
36+
rewriteRun(
37+
//language=xml
38+
pomXml(
39+
"""
40+
<project>
41+
<modelVersion>4.0.0</modelVersion>
42+
<groupId>com.example</groupId>
43+
<artifactId>demo</artifactId>
44+
<version>0.0.1-SNAPSHOT</version>
45+
<dependencies>
46+
<dependency>
47+
<groupId>jakarta.jws</groupId>
48+
<artifactId>jakarta.jws-api</artifactId>
49+
<version>3.0.0</version>
50+
</dependency>
51+
<dependency>
52+
<groupId>jakarta.xml.ws</groupId>
53+
<artifactId>jakarta.xml.ws-api</artifactId>
54+
<version>3.0.0</version>
55+
</dependency>
56+
</dependencies>
57+
</project>
58+
""",
59+
spec -> spec.after(pom -> assertThat(pom)
60+
.doesNotContain("jakarta.jws")
61+
.contains("jakarta.xml.ws")
62+
.actual())
63+
)
64+
);
65+
}
66+
67+
@Test
68+
void noChangeWhenJakartaJwsApiNotPresent() {
69+
rewriteRun(
70+
//language=xml
71+
pomXml(
72+
"""
73+
<project>
74+
<modelVersion>4.0.0</modelVersion>
75+
<groupId>com.example</groupId>
76+
<artifactId>demo</artifactId>
77+
<version>0.0.1-SNAPSHOT</version>
78+
<dependencies>
79+
<dependency>
80+
<groupId>jakarta.xml.ws</groupId>
81+
<artifactId>jakarta.xml.ws-api</artifactId>
82+
<version>4.0.0</version>
83+
</dependency>
84+
</dependencies>
85+
</project>
86+
"""
87+
)
88+
);
89+
}
90+
}

0 commit comments

Comments
 (0)