JsonReporter extends AbstractFileReporter { @Override public void initialize(@Nonnull AnalysisContext analysisContext) { super.initialize(analysisContext); boolean prettyPrint = analysisContext.getConfiguration().get("indent").asBoolean(false); Map<String, Object> config = prettyPrint ? singletonMap(JsonGenerator.PRETTY_PRINTING, null) : emptyMap(); jsonFactory = JsonProvider.provider().createGeneratorFactory(config); this.reports = new TreeSet<>(getReportsByElementOrderComparator()); }  @Override String getExtensionId(); @Nullable @Override Reader getJSONSchema(); @Override void initialize(@Nonnull AnalysisContext analysisContext);  }
@Test public void testKeepEmptyFile() throws Exception { Path file = Files.createTempFile(null, null); try (Reporter reporter = new JsonReporter()) { StringBuffer buf = new StringBuffer(); buf.append("{"); buf.append("\"output\": \"").append(file.toString()).append("\""); buf.append(","); buf.append("\"keepEmptyFile\": \"").append("false").append("\""); buf.append("}"); reporter.initialize(AnalysisContext.builder() .build().copyWithConfiguration(ModelNode.fromJSONString(buf.toString()))); reporter.report(Report.builder().build()); } finally { assertFalse(file.toFile().exists()); } }