|
| 1 | +/* |
| 2 | + * Copyright 2024 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.openrewrite.maven.Assertions.pomXml; |
| 24 | + |
| 25 | +class JakartaEE9Test implements RewriteTest { |
| 26 | + |
| 27 | + @Override |
| 28 | + public void defaults(RecipeSpec spec) { |
| 29 | + spec.recipeFromResources("org.openrewrite.java.migrate.jakarta.JakartaEE10"); |
| 30 | + } |
| 31 | + |
| 32 | + @DocumentExample |
| 33 | + @Test |
| 34 | + void echacheFromJavaxToJakarta() { |
| 35 | + rewriteRun( |
| 36 | + spec -> spec.recipeFromResources("org.openrewrite.java.migrate.jakarta.EhcacheJavaxToJakarta"), |
| 37 | + pomXml( |
| 38 | + """ |
| 39 | + <project> |
| 40 | + <modelVersion>4.0.0</modelVersion> |
| 41 | + <groupId>com.example</groupId> |
| 42 | + <artifactId>parent</artifactId> |
| 43 | + <version>1.2.3</version> |
| 44 | + <packaging>pom</packaging> |
| 45 | + <dependencyManagement> |
| 46 | + <dependencies> |
| 47 | + <dependency> |
| 48 | + <groupId>org.ehcache</groupId> |
| 49 | + <artifactId>ehcache</artifactId> |
| 50 | + <version>3.10.9</version> |
| 51 | + </dependency> |
| 52 | + </dependencies> |
| 53 | + </dependencyManagement> |
| 54 | + </project> |
| 55 | + """, |
| 56 | + """ |
| 57 | + <project> |
| 58 | + <modelVersion>4.0.0</modelVersion> |
| 59 | + <groupId>com.example</groupId> |
| 60 | + <artifactId>parent</artifactId> |
| 61 | + <version>1.2.3</version> |
| 62 | + <packaging>pom</packaging> |
| 63 | + <dependencyManagement> |
| 64 | + <dependencies> |
| 65 | + <dependency> |
| 66 | + <groupId>org.ehcache</groupId> |
| 67 | + <artifactId>ehcache</artifactId> |
| 68 | + <version>3.10.0</version> |
| 69 | + <classifier>jakarta</classifier> |
| 70 | + </dependency> |
| 71 | + </dependencies> |
| 72 | + </dependencyManagement> |
| 73 | + </project> |
| 74 | + """ |
| 75 | + ), |
| 76 | + pomXml( |
| 77 | + """ |
| 78 | + <project> |
| 79 | + <modelVersion>4.0.0</modelVersion> |
| 80 | + <parent> |
| 81 | + <groupId>com.example</groupId> |
| 82 | + <artifactId>parent</artifactId> |
| 83 | + <version>1.2.3</version> |
| 84 | + </parent> |
| 85 | + <artifactId>child</artifactId> |
| 86 | + <dependencies> |
| 87 | + <dependency> |
| 88 | + <groupId>org.ehcache</groupId> |
| 89 | + <artifactId>ehcache</artifactId> |
| 90 | + </dependency> |
| 91 | + </dependencies> |
| 92 | + </project> |
| 93 | + """ |
| 94 | + ) |
| 95 | + ); |
| 96 | + } |
| 97 | +} |
0 commit comments