Skip to content

Commit

Permalink
Add test showing multi module project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Sep 21, 2024
1 parent 6c3cdd7 commit 4f23297
Showing 1 changed file with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;

import static org.openrewrite.java.Assertions.mavenProject;
import static org.openrewrite.java.Assertions.srcMainResources;
import static org.openrewrite.properties.Assertions.properties;

class SeparateApplicationPropertiesByProfileTest implements RewriteTest {
Expand Down Expand Up @@ -273,4 +275,60 @@ void pathToApplicationProperties() {
)
);
}

@Test
void multiModuleProject() {
rewriteRun(
mavenProject("parent",
mavenProject("service",
srcMainResources(
properties(
"""
global.service=true
!---
spring.config.activate.on-profile=dev
dev.service=true
""",
"""
global.service=true
""",
spec -> spec.path("application.properties")
),
properties(
null,
"""
dev.service=true
""",
spec -> spec.path("application-dev.properties")
)
)
),
mavenProject("client",
srcMainResources(
properties("""
global.client=true
!---
spring.config.activate.on-profile=dev
dev.client=true
""",
"""
global.client=true
""",
spec -> spec.path("application.properties")
),
properties(
"""
dev.existing=true
""",
"""
dev.existing=true
dev.client=true
""",
spec -> spec.path("application-dev.properties")
)
)
)
)
);
}
}

0 comments on commit 4f23297

Please sign in to comment.