diff --git a/components/sbm-core/src/test/java/org/springframework/sbm/project/buildfile/OpenRewriteMavenBuildFileTest.java b/components/sbm-core/src/test/java/org/springframework/sbm/project/buildfile/OpenRewriteMavenBuildFileTest.java index 5e22ff7d8..bae4079fc 100644 --- a/components/sbm-core/src/test/java/org/springframework/sbm/project/buildfile/OpenRewriteMavenBuildFileTest.java +++ b/components/sbm-core/src/test/java/org/springframework/sbm/project/buildfile/OpenRewriteMavenBuildFileTest.java @@ -21,6 +21,7 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mockito; import org.springframework.context.ApplicationEventPublisher; +import org.springframework.sbm.GitHubIssue; import org.springframework.sbm.build.api.BuildFile; import org.springframework.sbm.build.api.DependenciesChangedEvent; import org.springframework.sbm.build.api.Dependency; @@ -2655,26 +2656,27 @@ void hasParentWithParentShouldReturnParent() { @Test void upgradeParentVersion() { - String pomXml = - "\n" + - "\n" + - " 4.0.0\n" + - " \n" + - " org.springframework.boot\n" + - " spring-boot-starter-parent\n" + - " 2.4.12\n" + - " \n" + - " \n" + - " com.example\n" + - " spring-boot-24-to-25-example\n" + - " 0.0.1-SNAPSHOT\n" + - " spring-boot-2.4-to-2.5-example\n" + - " spring-boot-2.4-to-2.5-example\n" + - " \n" + - " 11\n" + - " \n" + - "\n"; + String pomXml = """ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.4.12 + + + com.example + spring-boot-24-to-25-example + 0.0.1-SNAPSHOT + spring-boot-2.4-to-2.5-example + spring-boot-2.4-to-2.5-example + + 11 + + + """; BuildFile openRewriteMavenBuildFile = TestProjectContext.buildProjectContext().withMavenRootBuildFileSource(pomXml).build().getBuildFile(); @@ -2683,4 +2685,25 @@ void upgradeParentVersion() { assertThat(openRewriteMavenBuildFile.getParentPomDeclaration()).isNotEmpty(); assertThat(openRewriteMavenBuildFile.getParentPomDeclaration().get().getVersion()).isEqualTo("2.5.6"); } + + @GitHubIssue("https://github.com/spring-projects-experimental/spring-boot-migrator/issues/55") + @Test + void parsingPomWithEmptyPropertiesSectionShouldSucceed() { + String pomXml = """ + + + 4.0.0 + org.springframework.boot + spring-boot-starter-parent + 2.4.12 + + + + + """; + + ProjectContext projectContext = TestProjectContext.buildProjectContext().withMavenRootBuildFileSource(pomXml).build(); + assertThat(projectContext.getApplicationModules().getRootModule().getBuildFile()).isNotNull(); + } }