From ed731fab5c1cf638ab5ab9cc27b7b7ac7316c168 Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Thu, 29 Aug 2024 13:41:20 +0200 Subject: [PATCH] Use `Parser.Input#fromString()` in `RewriteTest` The idea is to get the `synthetic` flag to be set to `true`. --- .../src/main/java/org/openrewrite/test/RewriteTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rewrite-test/src/main/java/org/openrewrite/test/RewriteTest.java b/rewrite-test/src/main/java/org/openrewrite/test/RewriteTest.java index 201f0a94712..2560c78f508 100644 --- a/rewrite-test/src/main/java/org/openrewrite/test/RewriteTest.java +++ b/rewrite-test/src/main/java/org/openrewrite/test/RewriteTest.java @@ -266,7 +266,7 @@ default void rewriteRun(Consumer spec, SourceSpec... sourceSpecs) for (UncheckedConsumer> consumer : testClassSpec.allSources) { consumer.accept(sourceSpec); } - inputs.put(sourceSpec, new Parser.Input(sourcePath, () -> new ByteArrayInputStream(beforeTrimmed.getBytes(parser.getCharset(ctx))))); + inputs.put(sourceSpec, Parser.Input.fromString(sourcePath, beforeTrimmed, parser.getCharset(ctx))); } Path relativeTo = testMethodSpec.relativeTo == null ? testClassSpec.relativeTo : testMethodSpec.relativeTo;