|
15 | 15 | */ |
16 | 16 | package org.openrewrite.java.testing.mockito |
17 | 17 |
|
| 18 | +import org.junit.jupiter.api.Assertions.assertEquals |
| 19 | +import org.junit.jupiter.api.Disabled |
18 | 20 | import org.junit.jupiter.api.Test |
19 | 21 | import org.openrewrite.* |
20 | 22 | import org.openrewrite.java.JavaParser |
21 | | -import org.openrewrite.java.OrderImports |
22 | 23 | import org.openrewrite.java.tree.J |
| 24 | +import org.openrewrite.maven.MavenParser |
23 | 25 |
|
24 | 26 | /** |
25 | 27 | * Validates the recipes related to upgrading from Mockito 1 to Mockito 3 |
@@ -454,4 +456,94 @@ class JunitMockitoUpgradeIntegrationTest : RefactorVisitorTestForParser<J.Compil |
454 | 456 | } |
455 | 457 | """ |
456 | 458 | ) |
| 459 | + |
| 460 | + @Disabled("https://github.com/openrewrite/rewrite/issues/92") |
| 461 | + @Test |
| 462 | + fun upgradesPom() { |
| 463 | + val pom = MavenParser.builder().build().parse(""" |
| 464 | + <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| 465 | + <modelVersion>4.0.0</modelVersion> |
| 466 | + |
| 467 | + <groupId>org.openrewrite.example</groupId> |
| 468 | + <artifactId>integration-testing</artifactId> |
| 469 | + <version>1.0</version> |
| 470 | + <name>integration-testing</name> |
| 471 | + |
| 472 | + <properties> |
| 473 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 474 | + <java.version>1.8</java.version> |
| 475 | + </properties> |
| 476 | + |
| 477 | + <dependencies> |
| 478 | + <dependency> |
| 479 | + <groupId>junit</groupId> |
| 480 | + <artifactId>junit</artifactId> |
| 481 | + <version>4.12</version> |
| 482 | + <scope>test</scope> |
| 483 | + </dependency> |
| 484 | + </dependencies> |
| 485 | + |
| 486 | + <build> |
| 487 | + <plugins> |
| 488 | + <plugin> |
| 489 | + <groupId>org.apache.maven.plugins</groupId> |
| 490 | + <artifactId>maven-surefire-plugin</artifactId> |
| 491 | + <version>3.0.0-M5</version> |
| 492 | + </plugin> |
| 493 | + </plugins> |
| 494 | + </build> |
| 495 | + </project> |
| 496 | + """.trimIndent()) |
| 497 | + |
| 498 | + val fixed = Refactor(true) |
| 499 | + .visit(visitors) |
| 500 | + .fix(pom) |
| 501 | + .first() |
| 502 | + .fixed!! |
| 503 | + .printTrimmed() |
| 504 | + |
| 505 | + val expected = """ |
| 506 | + <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| 507 | + <modelVersion>4.0.0</modelVersion> |
| 508 | + |
| 509 | + <groupId>org.openrewrite.example</groupId> |
| 510 | + <artifactId>integration-testing</artifactId> |
| 511 | + <version>1.0</version> |
| 512 | + <name>integration-testing</name> |
| 513 | + |
| 514 | + <properties> |
| 515 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 516 | + <java.version>1.8</java.version> |
| 517 | + </properties> |
| 518 | + |
| 519 | + <dependencies> |
| 520 | + <dependency> |
| 521 | + <groupId>org.junit.jupiter</groupId> |
| 522 | + <artifactId>junit-jupiter-api</artifactId> |
| 523 | + <version>5.7.0</version> |
| 524 | + <scope>test</scope> |
| 525 | + </dependency> |
| 526 | + <dependency> |
| 527 | + <groupId>org.junit.jupiter</groupId> |
| 528 | + <artifactId>junit-jupiter-engine</artifactId> |
| 529 | + <version>5.7.0</version> |
| 530 | + <scope>test</scope> |
| 531 | + </dependency> |
| 532 | + </dependencies> |
| 533 | + |
| 534 | + <build> |
| 535 | + <plugins> |
| 536 | + <plugin> |
| 537 | + <groupId>org.apache.maven.plugins</groupId> |
| 538 | + <artifactId>maven-surefire-plugin</artifactId> |
| 539 | + <version>3.0.0-M5</version> |
| 540 | + </plugin> |
| 541 | + </plugins> |
| 542 | + </build> |
| 543 | + </project> |
| 544 | + """.trimIndent() |
| 545 | + |
| 546 | + assertEquals(expected, fixed) |
| 547 | + } |
| 548 | + |
457 | 549 | } |
0 commit comments