Skip to content

Commit

Permalink
switch to json writer
Browse files Browse the repository at this point in the history
  • Loading branch information
Kr0nox committed Nov 15, 2023
1 parent 080fe20 commit c1e8b6b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
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
* a function that associates a submission to its id.
*/
public class ComparisonReportWriter {

private final FileWriter<Object> fileWriter;
private final JsonWriter fileWriter;
private final Function<Submission, String> submissionToIdFunction;
private final Map<String, Map<String, String>> submissionIdToComparisonFileName = new ConcurrentHashMap<>();
private final Map<String, AtomicInteger> fileNameCollisions = new ConcurrentHashMap<>();

public ComparisonReportWriter(Function<Submission, String> submissionToIdFunction, FileWriter<Object> fileWriter) {
public ComparisonReportWriter(Function<Submission, String> submissionToIdFunction, JsonWriter fileWriter) {
this.submissionToIdFunction = submissionToIdFunction;
this.fileWriter = fileWriter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DummyWriter implements FileWriter<Object> {
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.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object> fileWriter = new DummyWriter();
private final JsonWriter fileWriter = new DummyWriter();

@Test
public void firsLevelOfLookupMapComplete() throws ExitException {
Expand Down

0 comments on commit c1e8b6b

Please sign in to comment.