This test fails with the Expected recipe to complete in 1 cycle, but took 2 cycles. Each individual recipe would pass its own equivalent test, so this is a minimal subset required to fail the test.
Also this test no longer fails if the JSON matcher passed to DeleteKey is $.x rather than $.*. So there is clearly something different about how DeleteKey operates when asked to remove all root entries rather than the only root entry.
import org.junit.jupiter.api.Test;
import org.openrewrite.config.CompositeRecipe;
import org.openrewrite.test.RewriteTest;
import java.util.List;
import static org.openrewrite.yaml.Assertions.yaml;
class CycleTest implements RewriteTest {
@Test
void testCycles() {
rewriteRun(
spec -> spec.recipe(
new CompositeRecipe(
List.of(
new DeleteKey("$.*", null),
new MergeYaml("$", "foo: bar", null, "test.yml", null, null, null, null)
)
)
),
yaml(
"""
x: y
""",
"""
foo: bar
""",
spec -> spec.path("test.yml")
)
);
}
}
Slack Message
Slack Message