Skip to content

Commit 17ccb93

Browse files
committed
- t inline to improve test readability
1 parent ddd5b4b commit 17ccb93

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

approvaltests-tests/src/test/java/org/approvaltests/inline/InlineApprovalsTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ void testSemiAutomatic()
140140
***** DELETE ME TO APPROVE *****
141141
""";
142142
Options options = new Options().inline("", InlineOptions.semiAutomatic());
143-
Mutable<String> result = hijackInlineReporter(options, AutoApproveReporter.class);
143+
Mutable<String> result = hijackInlineReporter(options);
144144
Action1<Throwable> assertion = e -> assertEquals(expected, result.get());
145145
assertApprovalFailure("hello Lars", options, assertion);
146146
}
@@ -151,9 +151,8 @@ void testAutomatic()
151151
hello Oskar
152152
""";
153153
Options options = new Options().inline("", InlineOptions.automatic());
154-
Mutable<String> result = hijackInlineReporter(options, AutoApproveReporter.class);
155-
Action1<Throwable> assertion = e -> assertEquals(expected, result.get());
156-
assertApprovalFailure("hello Oskar", options, assertion);
154+
assertApprovalFailure("hello Oskar", options,
155+
e -> assertEquals(expected, hijackInlineReporter(options).get()));
157156
}
158157
private static void assertApprovalFailure(String actual, Options options, Action1<Throwable> azzert)
159158
{
@@ -169,10 +168,10 @@ private static void assertApprovalFailure(String actual, Options options, Action
169168
}
170169
assertTrue(failed, "Approval should have failed");
171170
}
172-
private static Mutable<String> hijackInlineReporter(Options options, Class<AutoApproveReporter> reporterClass)
171+
private static Mutable<String> hijackInlineReporter(Options options)
173172
{
174173
InlineJavaReporter reporter = (InlineJavaReporter) options.getReporter();
175-
assertEquals(reporter.reporter.getClass(), reporterClass);
174+
assertEquals(reporter.reporter.getClass(), AutoApproveReporter.class);
176175
reporter.reporter = new QuietReporter();
177176
Mutable<String> result = new Mutable<>("");
178177
reporter.createNewReceivedFileText = (s, a, m) -> result.set(a);

0 commit comments

Comments
 (0)