@Test public void testDriver() { final String EXPECTED_VERSION = Version.VERSION_STRING; final String EXPECTED_LANGUAGE = "ja"; Locale defaultLocale = Locale.getDefault(); try { Locale.setDefault(Locale.JAPANESE); reporter.finish(); } finally { Locale.setDefault(defaultLocale); } String json = writer.toString(); JSONObject jsonObject = new JSONObject(json); JSONObject run = jsonObject.getJSONArray("runs").getJSONObject(0); JSONObject tool = run.getJSONObject("tool"); JSONObject driver = tool.getJSONObject("driver"); assertThat(driver.get("name"), is("SpotBugs")); assertThat(driver.get("version"), is(EXPECTED_VERSION)); assertThat(driver.get("language"), is(EXPECTED_LANGUAGE)); }
@Override public void finish() { try { JSONWriter jsonWriter = new JSONWriter(outputStream); jsonWriter.object(); jsonWriter.key("version").value("2.1.0").key("$schema").value( "https: processRuns(jsonWriter); jsonWriter.endObject(); getBugCollection().bugsPopulated(); } finally { outputStream.close(); } }
SarifBugReporter extends BugCollectionBugReporter { @Override public void finish() { try { JSONWriter jsonWriter = new JSONWriter(outputStream); jsonWriter.object(); jsonWriter.key("version").value("2.1.0").key("$schema").value( "https: processRuns(jsonWriter); jsonWriter.endObject(); getBugCollection().bugsPopulated(); } finally { outputStream.close(); } } }
SarifBugReporter extends BugCollectionBugReporter { @Override public void finish() { try { JSONWriter jsonWriter = new JSONWriter(outputStream); jsonWriter.object(); jsonWriter.key("version").value("2.1.0").key("$schema").value( "https: processRuns(jsonWriter); jsonWriter.endObject(); getBugCollection().bugsPopulated(); } finally { outputStream.close(); } } SarifBugReporter(Project project); }
SarifBugReporter extends BugCollectionBugReporter { @Override public void finish() { try { JSONWriter jsonWriter = new JSONWriter(outputStream); jsonWriter.object(); jsonWriter.key("version").value("2.1.0").key("$schema").value( "https: processRuns(jsonWriter); jsonWriter.endObject(); getBugCollection().bugsPopulated(); } finally { outputStream.close(); } } SarifBugReporter(Project project); @Override void finish(); }
SarifBugReporter extends BugCollectionBugReporter { @Override public void finish() { try { JSONWriter jsonWriter = new JSONWriter(outputStream); jsonWriter.object(); jsonWriter.key("version").value("2.1.0").key("$schema").value( "https: processRuns(jsonWriter); jsonWriter.endObject(); getBugCollection().bugsPopulated(); } finally { outputStream.close(); } } SarifBugReporter(Project project); @Override void finish();  }