### Question:
MatchReporter extends LuceneReporter { @Override public void reportResults (Map<String, String> fromRecord, List<Map<String, String>> matches) throws IOException { String namespace = this.getNameSpacePrefix(); fromRecord.put("configLog", this.getConfigLog()); fromRecord.put(namespace + "total_matches", this.getClusterSize(fromRecord, matches)); fromRecord.put(namespace + "matching_ids", this.getIDsInCluster(fromRecord, matches, this.getIdDelimiter())); if (matches.size() > 0) fromRecord.putAll(Reporter.getNamespacedCopy(matches.get(0), namespace + "authority_")); this.writer.write(fromRecord, this.header); } MatchReporter(); @Override void reportResults(Map<String, String> fromRecord, List<Map<String, String>> matches);  }### Answer:
@Test public void testQuotedCsv() throws Exception { File tempFile = File.createTempFile("MatchReporterTest-", ".tsv"); MatchReporter reporter = new MatchReporter(); reporter.setName("MatchReporter"); reporter.setConfigName("Test_Config"); reporter.setDelimiter("\t"); reporter.setIdDelimiter("|"); reporter.setFile(tempFile); reporter.setWriter(); reporter.setDefinedOutputFields(new String[]{"property", "quote-test"}); reporter.writeHeader(); Map<String,String> fromRecord = new HashMap<>(); List<Map<String,String>> matches = new ArrayList<>(); String[][] records = new String[][]{ new String[]{"test-id", "test-value", "ABC 'DEF' GHI"}, new String[]{"id2", "value2", "ABC \"DEF\" GHI"}, new String[]{"id3", "value3", "ABC \"\"DEF\"\" GHI"}, new String[]{"id4", "value4", "\"ABC DEF GHI\""}, new String[]{"id2", "value2", "\"ABC DEF GHI"}, new String[]{"id2", "value2", "\"\"ABC DEF GHI"}, new String[]{"id2", "value2", "\""}, new String[]{"id2", "value2", "\"\""}, new String[]{"id2", "value2", "\"\"\""} }; for (String[] r : records) { fromRecord.put("id", r[0]); fromRecord.put("property", r[1]); fromRecord.put("quote-test", r[2]); reporter.reportResults(fromRecord, matches); } reporter.close(); CsvPreference customCsvPref = new CsvPreference.Builder('"', '\t', "\n").build(); int i = 0; try (CsvMapReader mr = new CsvMapReader(new InputStreamReader(new FileInputStream(tempFile), "UTF-8"), customCsvPref)) { final String[] header = mr.getHeader(true); logger.info("CSV header is {}", (Object[])header); Map<String, String> record; record = mr.read(header); while (record != null) { logger.info("Expecting record {}, {}, {}", records[i][0], records[i][1], records[i][2]); logger.info("Read record {}", record); assertTrue(record.get("id").equals(records[i][0])); assertTrue(record.get("property").equals(records[i][1])); assertTrue(record.get("quote-test").equals(records[i][2])); record = mr.read(header); i++; } } catch (Exception e) { Assert.fail(e.toString()); } }