diff --git a/approvaltests-tests/src/test/java/org/approvaltests/inline/InlineApprovalsTest.java b/approvaltests-tests/src/test/java/org/approvaltests/inline/InlineApprovalsTest.java index eaff5c55..528cbeda 100644 --- a/approvaltests-tests/src/test/java/org/approvaltests/inline/InlineApprovalsTest.java +++ b/approvaltests-tests/src/test/java/org/approvaltests/inline/InlineApprovalsTest.java @@ -114,11 +114,11 @@ public void testReportingCode() void testEmptyLineAtTheEnd() { var expected = """ - Jeff Jeffty Jeff - born on Jeffteen of Jeff, Nineteen-eighty-Jeff - - """; - Approvals.verify(greet("Jeff"), new Options().inline(expected)); + Jeff Jeffty Jeff + born on Jeffteen of Jeff, Nineteen-eighty-Jeff + + """; + Approvals.verify(greet("Jeff"), new Options().inline(expected, InlineOptions.automatic())); } private String greet(String name) { @@ -128,4 +128,4 @@ private String greet(String name) """.formatted(name, name, name, name, name, name); } -} +} \ No newline at end of file diff --git a/approvaltests/src/main/java/org/approvaltests/inline/InlineOptions.java b/approvaltests/src/main/java/org/approvaltests/inline/InlineOptions.java index aaf13278..5f9a21f2 100644 --- a/approvaltests/src/main/java/org/approvaltests/inline/InlineOptions.java +++ b/approvaltests/src/main/java/org/approvaltests/inline/InlineOptions.java @@ -1,6 +1,7 @@ package org.approvaltests.inline; import org.approvaltests.core.Options; +import org.approvaltests.reporters.AutoApproveReporter; public interface InlineOptions { @@ -9,25 +10,15 @@ public static InlineOptions showCode(boolean doShowCode) { if (doShowCode) { - return new ShowCodeInlineOptions(); + return options -> options.withReporter(new InlineJavaReporter(options.getReporter())); } else { - return new DoNotShowCodeInlineOptions(); + return options -> options; } } - public static class ShowCodeInlineOptions implements InlineOptions + public static InlineOptions automatic() { - public Options apply(Options options) - { - return options.withReporter(new InlineJavaReporter(options.getReporter())); - } - } - public static class DoNotShowCodeInlineOptions implements InlineOptions - { - public Options apply(Options options) - { - return options; - } + return options -> options.withReporter(new InlineJavaReporter(new AutoApproveReporter())); } }