use of com.mercedesbenz.sechub.sarif.model.Taxonomy in project sechub by mercedes-benz.
the class SarifReportSupportTest method microsoft_sarif_tutorial_taxonomies_example_taxonomies_deserialized_correclty.
@Test
void microsoft_sarif_tutorial_taxonomies_example_taxonomies_deserialized_correclty() throws IOException {
/* prepare */
File codeFlowReportFile = new File(sarifTutorialSamplesFolder, "Taxonomies.sarif");
/* execute */
Report report = supportToTest.loadReport(codeFlowReportFile);
/* test */
List<Run> runs = report.getRuns();
assertEquals(1, runs.size(), "there must be ONE run!");
Run run = runs.iterator().next();
List<Taxonomy> taxonomies = run.getTaxonomies();
Map<String, Taxonomy> sortedTaxonomiesMap = new TreeMap<>();
for (Taxonomy taxonomy : taxonomies) {
sortedTaxonomiesMap.put(taxonomy.getGuid(), taxonomy);
}
Taxonomy taxonomy1 = sortedTaxonomiesMap.get("1A567403-868F-405E-92CF-771A9ECB03A1");
assertEquals("Requirement levels", taxonomy1.getName());
assertEquals(new Message("This taxonomy classifies rules according to whether their use is required or recommended by company policy."), taxonomy1.getShortDescription());
Map<String, Taxon> sortedTaxaMap = new TreeMap<>();
for (Taxon taxon : taxonomy1.getTaxa()) {
sortedTaxaMap.put(taxon.getId(), taxon);
}
Taxon taxon1 = sortedTaxaMap.get("RQL1001");
assertNotNull(taxon1);
assertEquals("Required", taxon1.getName());
assertEquals(new Message("Rules in this category are required by company policy. All violations must be fixed unless an exemption is granted."), taxon1.getShortDescription());
Taxon taxon2 = sortedTaxaMap.get("RQL1002");
assertNotNull(taxon2);
assertEquals("Recommended", taxon2.getName());
assertEquals(new Message("Rules in this category are recommended but not required by company policy. Violations should be fixed but an exemption is not required to suppress a result."), taxon2.getShortDescription());
}
Aggregations