From c1e8b6be9b44597003d9c965d93e52e2f5878e6f Mon Sep 17 00:00:00 2001 From: Alex | Kronox Date: Wed, 15 Nov 2023 11:23:59 +0100 Subject: [PATCH] switch to json writer --- .../jplag/reporting/jsonfactory/ComparisonReportWriter.java | 6 +++--- .../de/jplag/reporting/reportobject/writer/DummyWriter.java | 2 +- .../reportobject/mapper/ComparisonReportWriterTest.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/de/jplag/reporting/jsonfactory/ComparisonReportWriter.java b/core/src/main/java/de/jplag/reporting/jsonfactory/ComparisonReportWriter.java index 2147761a0..8ebb4c555 100644 --- a/core/src/main/java/de/jplag/reporting/jsonfactory/ComparisonReportWriter.java +++ b/core/src/main/java/de/jplag/reporting/jsonfactory/ComparisonReportWriter.java @@ -16,7 +16,7 @@ import de.jplag.reporting.FilePathUtil; import de.jplag.reporting.reportobject.model.ComparisonReport; import de.jplag.reporting.reportobject.model.Match; -import de.jplag.reporting.reportobject.writer.FileWriter; +import de.jplag.reporting.reportobject.writer.JsonWriter; /** * Writes {@link ComparisonReport}s of given {@link JPlagResult} to the disk under the specified path. Instantiated with @@ -24,12 +24,12 @@ */ public class ComparisonReportWriter { - private final FileWriter fileWriter; + private final JsonWriter fileWriter; private final Function submissionToIdFunction; private final Map> submissionIdToComparisonFileName = new ConcurrentHashMap<>(); private final Map fileNameCollisions = new ConcurrentHashMap<>(); - public ComparisonReportWriter(Function submissionToIdFunction, FileWriter fileWriter) { + public ComparisonReportWriter(Function submissionToIdFunction, JsonWriter fileWriter) { this.submissionToIdFunction = submissionToIdFunction; this.fileWriter = fileWriter; } diff --git a/core/src/main/java/de/jplag/reporting/reportobject/writer/DummyWriter.java b/core/src/main/java/de/jplag/reporting/reportobject/writer/DummyWriter.java index be301b9c5..92258482f 100644 --- a/core/src/main/java/de/jplag/reporting/reportobject/writer/DummyWriter.java +++ b/core/src/main/java/de/jplag/reporting/reportobject/writer/DummyWriter.java @@ -3,7 +3,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class DummyWriter implements FileWriter { +public class DummyWriter extends JsonWriter { private static final Logger logger = LoggerFactory.getLogger(DummyWriter.class); private static final String MESSAGE = "DummyWriter writes object {} to path {} with name {} as JSON."; diff --git a/core/src/test/java/de/jplag/reporting/reportobject/mapper/ComparisonReportWriterTest.java b/core/src/test/java/de/jplag/reporting/reportobject/mapper/ComparisonReportWriterTest.java index 2af3fd15a..02af18f52 100644 --- a/core/src/test/java/de/jplag/reporting/reportobject/mapper/ComparisonReportWriterTest.java +++ b/core/src/test/java/de/jplag/reporting/reportobject/mapper/ComparisonReportWriterTest.java @@ -11,10 +11,10 @@ import de.jplag.exceptions.ExitException; import de.jplag.reporting.jsonfactory.ComparisonReportWriter; import de.jplag.reporting.reportobject.writer.DummyWriter; -import de.jplag.reporting.reportobject.writer.FileWriter; +import de.jplag.reporting.reportobject.writer.JsonWriter; public class ComparisonReportWriterTest extends TestBase { - private final FileWriter fileWriter = new DummyWriter(); + private final JsonWriter fileWriter = new DummyWriter(); @Test public void firsLevelOfLookupMapComplete() throws ExitException {