Skip to content

Commit

Permalink
a reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 16, 2023
1 parent 395a61b commit 5573556
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,15 @@ public void testyMctest(int foo) {
Approvals.verifyAll("Substitution", inputs,
i -> InlineComparator.createNewReceivedFileText(i, "1\n2", "testyMctest"));
}

@Test
@UseReporter(QuietReporter.class)
public void testReportingCode()
{
Options inlineWithCode = new Options().inline("", true);
Options inlineNoCode = new Options().inline("", false);

var resultWithCode = inlineWithCode.getReporter();
assertEquals(InlineComparator.class, resultWithCode.getClass());
assertEquals(QuietReporter.class, ((FirstWorkingReporter)inlineNoCode.getReporter()).getReporters()[1].getClass());
assertEquals(QuietReporter.class,
((FirstWorkingReporter) inlineNoCode.getReporter()).getReporters()[1].getClass());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

public class Options
{

private enum Fields {
SCRUBBER, REPORTER, FILE_OPTIONS_FILE_EXTENSION, FILE_OPTIONS_NAMER, WRITER, COMPARATOR;
}
Expand All @@ -37,7 +36,7 @@ public Options inline(String expected)
}
public Options inline(String expected, boolean showCode)
{
InlineComparator inline = new InlineComparator(expected, showCode ? this.getReporter(): null);
InlineComparator inline = new InlineComparator(expected, showCode ? this.getReporter() : null);
return inline.setForOptions(this);
}
public Options(Scrubber scrubber)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ public class InlineComparator
ApprovalWriterFactory,
ApprovalFailureReporter
{
private final String sourceFilePath;
private final StackTraceNamer stackTraceNamer;
private String expected;
private final String sourceFilePath;
private final StackTraceNamer stackTraceNamer;
private String expected;
private final ApprovalFailureReporter reporter;
private String actual;
private File approvedFile;
private File receivedFile;
public int fileWrites = 0;
private String actual;
private File approvedFile;
private File receivedFile;
public int fileWrites = 0;
public InlineComparator(String expected, ApprovalFailureReporter reporter)
{
this.expected = expected;
Expand Down Expand Up @@ -173,9 +173,10 @@ public static String indent(String actual)
}
return output;
}

public Options setForOptions(Options options) {
if (reporter != null) {
public Options setForOptions(Options options)
{
if (reporter != null)
{
options = options.withReporter(this);
}
return options.withComparator(this) //
Expand Down

0 comments on commit 5573556

Please sign in to comment.