### Question:
CSVGenerator { public static String blacklistToCsv(final ImaBlacklistBaseline blacklistBaseline) { StringBuilder sb = new StringBuilder(); CSVPrinter csvPrinter; try { csvPrinter = CSVFormat.DEFAULT.withRecordSeparator(System.lineSeparator()).print(sb); for (ImaBlacklistRecord record : blacklistBaseline.getRecords()) { String digest = ""; Digest hash = record.getHash(); if (hash != null) { digest = hash.toString(); } csvPrinter.printRecord( nullToEmpty(record.getPath()), digest, nullToEmpty(record.getDescription()) ); } } catch (IOException e) { throw new RuntimeException("Could not instantiate CSV printer"); } return sb.toString(); } private  CSVGenerator(); static String imaRecordsToCsv(final ImaAcceptableRecordBaseline imaBaseline); static String ignoreSetToCsv(final ImaIgnoreSetBaseline ignoreSetBaseline); static String blacklistToCsv(final ImaBlacklistBaseline blacklistBaseline); static String tpmRecordsToCsv(final TPMBaseline tpmBaseline); static String nullToEmpty(final String str);  }### Answer:
@Test public void testImaBlacklistBaselineWithDescriptionsToCsv() throws IOException { Assert.assertEquals( CSVGenerator.blacklistToCsv(getTestImaBlacklistBaselineWithDescriptions()), IOUtils.toString(getClass().getResource("/ima/IMABlacklistBaseline.csv")) ); }
@Test public void testImaBlacklistBaselineWithoutDescriptionsToCsv() throws IOException { Assert.assertEquals( CSVGenerator.blacklistToCsv(getTestImaBlacklistBaselineWithoutDescriptions()), IOUtils.toString( getClass().getResource("/ima/IMABlacklistBaselineNoDescriptions.csv") ) ); }