ReporterUtils { public static ScheduledReporter createCsvReporter( MetricRegistry metricRegistry, Map<String, Object> config) throws BaleenException { String directoryPath = (String) config.getOrDefault("directory", "metrics"); File directory = new File(directoryPath); if (!directory.exists() && !directory.mkdirs()) { throw new BaleenException("Unable to create directories for CSV Reporter"); } return CsvReporter.forRegistry(metricRegistry) .convertRatesTo(getRatesUnit(config)) .convertDurationsTo(getDurationUnit(config)) .build(directory); } private  ReporterUtils(); static ScheduledReporter createConsoleReporter(
      MetricRegistry metricRegistry, Map<String, Object> config); static ScheduledReporter createCsvReporter(
      MetricRegistry metricRegistry, Map<String, Object> config); static ScheduledReporter createSlf4jReporter(
      MetricRegistry metricRegistry, Map<String, Object> config);  }
@Test public void testCreateCsvReporter() throws BaleenException { ScheduledReporter reporter = ReporterUtils.createCsvReporter(registry, new HashMap<String, Object>()); assertNotNull(reporter); }
@Test public void testCreateCsvReporterBadLocation() throws BaleenException { Map<String, Object> config = new HashMap<>(); config.put("directory", "ABC:\\null\u0000\\test"); try { ReporterUtils.createCsvReporter(registry, config); fail("Expected exception not thrown"); } catch (BaleenException be) { } }