test cases:
@Test
void moveSubpropertyOut() {
rewriteRun(
spec -> spec.recipe(new ChangePropertyKey("foo.bar", "bar", null, null, null)),
yaml(
"""
foo:
bar:
prop: val
other: other-val
""",
"""
foo:
other: other-val
bar:
prop: val
"""
)
);
}
@Test
void multiDocument() {
rewriteRun(
spec -> spec.recipe(new ChangePropertyKey("foo.bar", "bar", null, null, null)),
yaml(
"""
a: b
---
foo:
bar:
prop: val
other: other-val
""",
"""
a: b
---
other: other-val
bar:
prop: val
"""
)
);
}
These cases yield these failures:
expected: "foo:
other: other-val
bar:
prop: val"
but was: "
foo:
other: other-val
bar:
prop: val"
...and...
expected: "a: b
---
other: other-val
bar:
prop: val"
but was: "a: b
---other: val
bar:
prop: val"
test cases:
These cases yield these failures:
...and...