|
28 | 28 | import org.openrewrite.InMemoryExecutionContext;
|
29 | 29 | import org.openrewrite.Parser;
|
30 | 30 | import org.openrewrite.SourceFile;
|
| 31 | +import org.openrewrite.java.tree.J; |
31 | 32 | import org.openrewrite.shaded.jgit.api.errors.GitAPIException;
|
32 | 33 | import org.openrewrite.tree.ParsingEventListener;
|
33 | 34 | import org.openrewrite.tree.ParsingExecutionContextView;
|
|
59 | 60 | */
|
60 | 61 | @DisabledOnOs(value = OS.WINDOWS, disabledReason = "The repository URIs of dependencies differ.")
|
61 | 62 | @Issue("https://github.com/spring-projects/spring-rewrite-commons/issues/12")
|
| 63 | +@Disabled("https://github.com/spring-projects/spring-rewrite-commons/issues/81") |
62 | 64 | class RewriteProjectParserParityTest {
|
63 | 65 |
|
| 66 | + @Test |
| 67 | + @DisplayName("parseResources") |
| 68 | + void parseResources() { |
| 69 | + Path baseDir = TestProjectHelper.getMavenProject("resources"); |
| 70 | + ParserParityTestHelper.scanProjectDir(baseDir).verifyParity((comparingParsingResult, testedParsingResult) -> { |
| 71 | + assertThat(comparingParsingResult.sourceFiles()).hasSize(5); |
| 72 | + }); |
| 73 | + } |
| 74 | + |
| 75 | + @Test |
| 76 | + @DisplayName("testFailingProject") |
| 77 | + void testFailingProject() { |
| 78 | + Path baseDir = Path.of("./testcode/maven-projects/failing"); |
| 79 | + ParserParityTestHelper.scanProjectDir(baseDir).verifyParity((comparingParsingResult, testedParsingResult) -> { |
| 80 | + assertThat(comparingParsingResult.sourceFiles().get(1)).isInstanceOf(J.CompilationUnit.class); |
| 81 | + J.CompilationUnit cu = (J.CompilationUnit) comparingParsingResult.sourceFiles().get(1); |
| 82 | + assertThat(cu.getTypesInUse() |
| 83 | + .getTypesInUse() |
| 84 | + .stream() |
| 85 | + .map(t -> t.toString()) |
| 86 | + .anyMatch(t -> t.equals("javax.validation.constraints.Min"))).isTrue(); |
| 87 | + |
| 88 | + assertThat(testedParsingResult.sourceFiles().get(1)).isInstanceOf(J.CompilationUnit.class); |
| 89 | + J.CompilationUnit cu2 = (J.CompilationUnit) testedParsingResult.sourceFiles().get(1); |
| 90 | + assertThat(cu2.getTypesInUse() |
| 91 | + .getTypesInUse() |
| 92 | + .stream() |
| 93 | + .map(t -> t.toString()) |
| 94 | + .anyMatch(t -> t.equals("javax.validation.constraints.Min"))).isTrue(); |
| 95 | + }); |
| 96 | + } |
| 97 | + |
| 98 | + @Test |
| 99 | + @DisplayName("parse4Modules") |
| 100 | + void parse4Modules() { |
| 101 | + Path baseDir = TestProjectHelper.getMavenProject("4-modules"); |
| 102 | + ParserParityTestHelper.scanProjectDir(baseDir).verifyParity((comparingParsingResult, testedParsingResult) -> { |
| 103 | + assertThat(comparingParsingResult.sourceFiles()).hasSize(4); |
| 104 | + assertThat(testedParsingResult.sourceFiles()).hasSize(4); |
| 105 | + }); |
| 106 | + } |
| 107 | + |
64 | 108 | @Test
|
65 | 109 | @DisplayName("Parsing Simplistic Maven Project ")
|
66 | 110 | void parsingSimplisticMavenProject(@TempDir Path tempDir) throws GitAPIException {
|
|
0 commit comments