Skip to content

Commit

Permalink
Fix ChangeSpringPropertyValue case for regex
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Feb 4, 2024
1 parent 8e0b4eb commit 50c4f8c
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,33 @@ class ChangeSpringPropertyValueTest implements RewriteTest {
@Test
void propFile() {
rewriteRun(
spec -> spec.recipe(new ChangeSpringPropertyValue("server.port", "8081", null, null, null)),
properties("server.port=8080", "server.port=8081")
spec -> spec.recipe(new ChangeSpringPropertyValue("server.port", "8081", null, null, null)),
properties("server.port=8080", "server.port=8081")
);
}

@Test
void yamlDotSeparated() {
rewriteRun(
spec -> spec.recipe(new ChangeSpringPropertyValue("server.port", "8081", null, null, null)),
yaml("server.port: 8080", "server.port: 8081")
spec -> spec.recipe(new ChangeSpringPropertyValue("server.port", "8081", null, null, null)),
yaml("server.port: 8080", "server.port: 8081")
);
}

@Test
void yamlIndented() {
rewriteRun(
spec -> spec.recipe(new ChangeSpringPropertyValue("server.port", "8081", null, null, null)),
yaml("server:\n port: 8080", "server:\n port: 8081")
spec -> spec.recipe(new ChangeSpringPropertyValue("server.port", "8081", null, null, null)),
yaml("server:\n port: 8080", "server:\n port: 8081")
);
}

@Test
void regex() {
rewriteRun(
spec -> spec.recipe(new ChangeSpringPropertyValue("server.port", "80$1", "([0-9]{2})", true, null)),
properties("server.port=53", "server.port=8053"),
yaml("server.port: 53", "server.port: 8053")
spec -> spec.recipe(new ChangeSpringPropertyValue("server.port", "80$1", "^([0-9]{2})$", true, null)),
properties("server.port=53", "server.port=8053"),
yaml("server.port: 53", "server.port: 8053")
);
}
}

0 comments on commit 50c4f8c

Please sign in to comment.