<commit_before>/*
 * Copyright 2009-2021 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.metaeffekt.core.inventory.processor.report;

import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Test;
import org.metaeffekt.core.inventory.processor.model.Inventory;
import org.metaeffekt.core.inventory.processor.model.VulnerabilityMetaData;

import java.util.Arrays;

public class VulnerabilityReportAdapterTest {

    private enum SEVERITY {
        CRITICAL,
        HIGH,
        MEDIUM,
        LOW,
        NONE
    }

    @Test
    public void createStatisticsOverviewTableTest() {
        Inventory inventory = new Inventory();
        VulnerabilityReportAdapter vra = new VulnerabilityReportAdapter(inventory);

        // start with an empty inventory
        {
            final VulnerabilityReportAdapter.StatisticsOverviewTable emptyStatistics = vra.createUnmodifiedStatisticsOverviewTable();
            Assert.assertTrue(emptyStatistics.isEmpty());

        }

        // add two VMDs (one CERT-FR, one CERT-FR + CERT-SEI; both applicable)
        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(VulnerabilityMetaData.STATUS_VALUE_APPLICABLE, SEVERITY.CRITICAL.toString(), "CERT-FR"));
        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(VulnerabilityMetaData.STATUS_VALUE_APPLICABLE, SEVERITY.CRITICAL.toString(), "CERT-FR", "CERT-SEI"));

        {
            final VulnerabilityReportAdapter.StatisticsOverviewTable nonEmptyStatistics = vra.createUnmodifiedStatisticsOverviewTable();
            Assert.assertFalse(nonEmptyStatistics.isEmpty());
        }

        {
            final VulnerabilityReportAdapter.StatisticsOverviewTable frStatisitics = vra.createUnmodifiedStatisticsOverviewTable("CERT-FR");
            Assert.assertFalse(frStatisitics.isEmpty());
            Assert.assertEquals(Arrays.asList("Severity", "Reviewed", "Total", "% Assessed"), frStatisitics.getHeaders());
            Assert.assertEquals(Arrays.asList("Critical", "High", "Medium", "Low"), frStatisitics.getSeverityCategories());
            Assert.assertEquals(Arrays.asList(2, 2, 100), frStatisitics.getCountsForSeverityCategory("critical"));
        }

        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(null, SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(null, SEVERITY.HIGH.toString()));

        {
            final VulnerabilityReportAdapter.StatisticsOverviewTable statistics = vra.createUnmodifiedStatisticsOverviewTable();
            Assert.assertFalse(statistics.isEmpty());
            Assert.assertEquals(Arrays.asList("Severity", "Reviewed", "In Review", "Total", "% Assessed"), statistics.getHeaders());
            Assert.assertEquals(Arrays.asList("Critical", "High", "Medium", "Low"), statistics.getSeverityCategories());
            Assert.assertEquals(Arrays.asList(2, 1, 3, 66), statistics.getCountsForSeverityCategory("critical"));
        }

        {
            final VulnerabilityReportAdapter.StatisticsOverviewTable seiStatistics = vra.createUnmodifiedStatisticsOverviewTable("CERT-SEI");
            Assert.assertEquals(Arrays.asList("Severity", "Reviewed", "Total", "% Assessed"), seiStatistics.getHeaders());
            Assert.assertEquals(Arrays.asList("Critical", "High", "Medium", "Low"), seiStatistics.getSeverityCategories());
            Assert.assertEquals(Arrays.asList(1, 1, 100), seiStatistics.getCountsForSeverityCategory("critical"));
        }

        {
            final VulnerabilityReportAdapter.StatisticsOverviewTable statistics = vra.createUnmodifiedStatisticsOverviewTable();
            Assert.assertEquals(Arrays.asList("Severity", "Reviewed", "In Review", "Total", "% Assessed"), statistics.getHeaders());
            Assert.assertEquals(Arrays.asList("Critical", "High", "Medium", "Low"), statistics.getSeverityCategories());
            Assert.assertEquals(Arrays.asList(2, 1, 3, 66), statistics.getCountsForSeverityCategory("critical"));
            Assert.assertEquals(Arrays.asList(0, 1, 1, 0), statistics.getCountsForSeverityCategory("high"));
        }

        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(VulnerabilityMetaData.STATUS_VALUE_VOID, null, "MSRC"));

        {
            final VulnerabilityReportAdapter.StatisticsOverviewTable msrcStatistics = vra.createUnmodifiedStatisticsOverviewTable("MSRC");
            Assert.assertEquals(Arrays.asList("Severity", "Void", "Total", "% Assessed"), msrcStatistics.getHeaders());
            Assert.assertEquals(Arrays.asList("Critical", "High", "Medium", "Low", "Unset"), msrcStatistics.getSeverityCategories());
            Assert.assertEquals(Arrays.asList(0, 0, 100), msrcStatistics.getCountsForSeverityCategory("high"));
            Assert.assertEquals(Arrays.asList(1, 1, 100), msrcStatistics.getCountsForSeverityCategory("unset"));
        }

        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(VulnerabilityMetaData.STATUS_VALUE_INSIGNIFICANT, SEVERITY.MEDIUM.toString(), "MSRC"));

        {
            final VulnerabilityReportAdapter.StatisticsOverviewTable msrcStatistics = vra.createUnmodifiedStatisticsOverviewTable("MSRC");
            Assert.assertEquals(Arrays.asList("Severity", "Void", "Insignificant", "Total", "% Assessed"), msrcStatistics.getHeaders());
            Assert.assertEquals(Arrays.asList("Critical", "High", "Medium", "Low", "Unset"), msrcStatistics.getSeverityCategories());
            Assert.assertEquals(Arrays.asList(0, 0, 0, 100), msrcStatistics.getCountsForSeverityCategory("high"));
            Assert.assertEquals(Arrays.asList(0, 1, 1, 100), msrcStatistics.getCountsForSeverityCategory("unset"));
            Assert.assertEquals(Arrays.asList(0, 1, 1, 0), msrcStatistics.getCountsForSeverityCategory("medium"));
        }
    }

    @Test
    public void createStatisticsOverviewTableAddStatusAfterwardsTest() {
        Inventory inventory = new Inventory();
        VulnerabilityReportAdapter vra = new VulnerabilityReportAdapter(inventory);

        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(null, SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(null, SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(null, SEVERITY.HIGH.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(null, SEVERITY.LOW.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(VulnerabilityMetaData.STATUS_VALUE_VOID, null));

        Assert.assertEquals(Arrays.asList(0, 1, 1, 100), vra.createUnmodifiedStatisticsOverviewTable().getCountsForSeverityCategory("unset"));
    }

    @Test
    public void createStatisticsOverviewForEffectiveValesTest() {
        Inventory inventory = new Inventory();
        VulnerabilityReportAdapter vra = new VulnerabilityReportAdapter(inventory);

        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("reviewed", SEVERITY.CRITICAL.toString(), SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("in review", SEVERITY.CRITICAL.toString(), SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("void", SEVERITY.CRITICAL.toString(), SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("insignificant", SEVERITY.CRITICAL.toString(), SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("not applicable", SEVERITY.CRITICAL.toString(), SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("reviewed", SEVERITY.HIGH.toString(), SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("reviewed", SEVERITY.HIGH.toString(), SEVERITY.HIGH.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("in review", SEVERITY.MEDIUM.toString(), SEVERITY.HIGH.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("in review", SEVERITY.MEDIUM.toString(), SEVERITY.MEDIUM.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity("in review", SEVERITY.MEDIUM.toString()));

        final VulnerabilityReportAdapter.StatisticsOverviewTable table = vra.createModifiedStatisticsOverviewTable(null, 0.0f);
        Assert.assertEquals(Arrays.asList("Severity", "Reviewed", "In Review", "Insignificant", "Total", "% Assessed"), table.getHeaders());
        Assert.assertEquals(Arrays.asList("Critical", "High", "Medium", "Low"), table.getSeverityCategories());
        Assert.assertEquals(Arrays.asList(2, 1, 1, 4, 50), table.getCountsForSeverityCategory("critical"));
        Assert.assertEquals(Arrays.asList(1, 1, 0, 2, 50), table.getCountsForSeverityCategory("high"));
        Assert.assertEquals(Arrays.asList(0, 2, 0, 2, 0), table.getCountsForSeverityCategory("medium"));
        Assert.assertEquals(Arrays.asList(0, 0, 0, 0, 100), table.getCountsForSeverityCategory("low"));
    }

    private VulnerabilityMetaData createVMDUnmodifiedSeverity(String status, String severity, String... cert) {
        VulnerabilityMetaData vmd = new VulnerabilityMetaData();

        vmd.set(VulnerabilityMetaData.Attribute.STATUS, status);
        vmd.set("CVSS Unmodified Severity (v3)", severity);
        JSONArray certs = new JSONArray();
        for (String c : cert) {
            certs.put(new JSONObject().put("source", c));
        }
        vmd.set("Advisories", certs.toString());

        return vmd;
    }

    private VulnerabilityMetaData createVMDMultipleSeverities(String status, String severityUnmodified, String severityModified, String... cert) {
        VulnerabilityMetaData vmd = new VulnerabilityMetaData();

        vmd.set(VulnerabilityMetaData.Attribute.STATUS, status);
        vmd.set("CVSS Unmodified Severity (v3)", severityUnmodified);
        vmd.set("CVSS Modified Severity (v3)", severityModified);
        JSONArray certs = new JSONArray();
        for (String c : cert) {
            certs.put(new JSONObject().put("source", c));
        }
        vmd.set("Advisories", certs.toString());

        return vmd;
    }

}<commit_msg>AEAA-221: Added test method for category abstraction functionality<commit_after>/*
 * Copyright 2009-2021 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.metaeffekt.core.inventory.processor.report;

import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Test;
import org.metaeffekt.core.inventory.processor.model.Inventory;
import org.metaeffekt.core.inventory.processor.model.VulnerabilityMetaData;

import java.util.Arrays;

public class VulnerabilityReportAdapterTest {

    private enum SEVERITY {
        CRITICAL,
        HIGH,
        MEDIUM,
        LOW,
        NONE
    }

    @Test
    public void createStatisticsOverviewTableTest() {
        Inventory inventory = new Inventory();
        VulnerabilityReportAdapter vra = new VulnerabilityReportAdapter(inventory);

        // start with an empty inventory
        {
            final VulnerabilityReportAdapter.StatisticsOverviewTable emptyStatistics = vra.createUnmodifiedStatisticsOverviewTable();
            Assert.assertTrue(emptyStatistics.isEmpty());

        }

        // add two VMDs (one CERT-FR, one CERT-FR + CERT-SEI; both applicable)
        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(VulnerabilityMetaData.STATUS_VALUE_APPLICABLE, SEVERITY.CRITICAL.toString(), "CERT-FR"));
        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(VulnerabilityMetaData.STATUS_VALUE_APPLICABLE, SEVERITY.CRITICAL.toString(), "CERT-FR", "CERT-SEI"));

        {
            final VulnerabilityReportAdapter.StatisticsOverviewTable nonEmptyStatistics = vra.createUnmodifiedStatisticsOverviewTable();
            Assert.assertFalse(nonEmptyStatistics.isEmpty());
        }

        {
            final VulnerabilityReportAdapter.StatisticsOverviewTable frStatisitics = vra.createUnmodifiedStatisticsOverviewTable("CERT-FR");
            Assert.assertFalse(frStatisitics.isEmpty());
            Assert.assertEquals(Arrays.asList("Severity", "Reviewed", "Total", "% Assessed"), frStatisitics.getHeaders());
            Assert.assertEquals(Arrays.asList("Critical", "High", "Medium", "Low"), frStatisitics.getSeverityCategories());
            Assert.assertEquals(Arrays.asList(2, 2, 100), frStatisitics.getCountsForSeverityCategory("critical"));
        }

        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(null, SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(null, SEVERITY.HIGH.toString()));

        {
            final VulnerabilityReportAdapter.StatisticsOverviewTable statistics = vra.createUnmodifiedStatisticsOverviewTable();
            Assert.assertFalse(statistics.isEmpty());
            Assert.assertEquals(Arrays.asList("Severity", "Reviewed", "In Review", "Total", "% Assessed"), statistics.getHeaders());
            Assert.assertEquals(Arrays.asList("Critical", "High", "Medium", "Low"), statistics.getSeverityCategories());
            Assert.assertEquals(Arrays.asList(2, 1, 3, 66), statistics.getCountsForSeverityCategory("critical"));
        }

        {
            final VulnerabilityReportAdapter.StatisticsOverviewTable seiStatistics = vra.createUnmodifiedStatisticsOverviewTable("CERT-SEI");
            Assert.assertEquals(Arrays.asList("Severity", "Reviewed", "Total", "% Assessed"), seiStatistics.getHeaders());
            Assert.assertEquals(Arrays.asList("Critical", "High", "Medium", "Low"), seiStatistics.getSeverityCategories());
            Assert.assertEquals(Arrays.asList(1, 1, 100), seiStatistics.getCountsForSeverityCategory("critical"));
        }

        {
            final VulnerabilityReportAdapter.StatisticsOverviewTable statistics = vra.createUnmodifiedStatisticsOverviewTable();
            Assert.assertEquals(Arrays.asList("Severity", "Reviewed", "In Review", "Total", "% Assessed"), statistics.getHeaders());
            Assert.assertEquals(Arrays.asList("Critical", "High", "Medium", "Low"), statistics.getSeverityCategories());
            Assert.assertEquals(Arrays.asList(2, 1, 3, 66), statistics.getCountsForSeverityCategory("critical"));
            Assert.assertEquals(Arrays.asList(0, 1, 1, 0), statistics.getCountsForSeverityCategory("high"));
        }

        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(VulnerabilityMetaData.STATUS_VALUE_VOID, null, "MSRC"));

        {
            final VulnerabilityReportAdapter.StatisticsOverviewTable msrcStatistics = vra.createUnmodifiedStatisticsOverviewTable("MSRC");
            Assert.assertEquals(Arrays.asList("Severity", "Void", "Total", "% Assessed"), msrcStatistics.getHeaders());
            Assert.assertEquals(Arrays.asList("Critical", "High", "Medium", "Low", "Unset"), msrcStatistics.getSeverityCategories());
            Assert.assertEquals(Arrays.asList(0, 0, 100), msrcStatistics.getCountsForSeverityCategory("high"));
            Assert.assertEquals(Arrays.asList(1, 1, 100), msrcStatistics.getCountsForSeverityCategory("unset"));
        }

        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(VulnerabilityMetaData.STATUS_VALUE_INSIGNIFICANT, SEVERITY.MEDIUM.toString(), "MSRC"));

        {
            final VulnerabilityReportAdapter.StatisticsOverviewTable msrcStatistics = vra.createUnmodifiedStatisticsOverviewTable("MSRC");
            Assert.assertEquals(Arrays.asList("Severity", "Void", "Insignificant", "Total", "% Assessed"), msrcStatistics.getHeaders());
            Assert.assertEquals(Arrays.asList("Critical", "High", "Medium", "Low", "Unset"), msrcStatistics.getSeverityCategories());
            Assert.assertEquals(Arrays.asList(0, 0, 0, 100), msrcStatistics.getCountsForSeverityCategory("high"));
            Assert.assertEquals(Arrays.asList(0, 1, 1, 100), msrcStatistics.getCountsForSeverityCategory("unset"));
            Assert.assertEquals(Arrays.asList(0, 1, 1, 0), msrcStatistics.getCountsForSeverityCategory("medium"));
        }
    }

    @Test
    public void createStatisticsOverviewTableAddStatusAfterwardsTest() {
        Inventory inventory = new Inventory();
        VulnerabilityReportAdapter vra = new VulnerabilityReportAdapter(inventory);

        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(null, SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(null, SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(null, SEVERITY.HIGH.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(null, SEVERITY.LOW.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity(VulnerabilityMetaData.STATUS_VALUE_VOID, null));

        Assert.assertEquals(Arrays.asList(0, 1, 1, 100), vra.createUnmodifiedStatisticsOverviewTable().getCountsForSeverityCategory("unset"));
    }

    @Test
    public void createStatisticsOverviewForEffectiveValesTest() {
        Inventory inventory = new Inventory();
        VulnerabilityReportAdapter vra = new VulnerabilityReportAdapter(inventory);

        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("reviewed", SEVERITY.CRITICAL.toString(), SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("in review", SEVERITY.CRITICAL.toString(), SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("void", SEVERITY.CRITICAL.toString(), SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("insignificant", SEVERITY.CRITICAL.toString(), SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("not applicable", SEVERITY.CRITICAL.toString(), SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("reviewed", SEVERITY.HIGH.toString(), SEVERITY.CRITICAL.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("reviewed", SEVERITY.HIGH.toString(), SEVERITY.HIGH.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("in review", SEVERITY.MEDIUM.toString(), SEVERITY.HIGH.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDMultipleSeverities("in review", SEVERITY.MEDIUM.toString(), SEVERITY.MEDIUM.toString()));
        inventory.getVulnerabilityMetaData().add(createVMDUnmodifiedSeverity("in review", SEVERITY.MEDIUM.toString()));

        final VulnerabilityReportAdapter.StatisticsOverviewTable table = vra.createModifiedStatisticsOverviewTable(null, 0.0f);
        Assert.assertEquals(Arrays.asList("Severity", "Reviewed", "In Review", "Insignificant", "Total", "% Assessed"), table.getHeaders());
        Assert.assertEquals(Arrays.asList("Critical", "High", "Medium", "Low"), table.getSeverityCategories());
        Assert.assertEquals(Arrays.asList(2, 1, 1, 4, 50), table.getCountsForSeverityCategory("critical"));
        Assert.assertEquals(Arrays.asList(1, 1, 0, 2, 50), table.getCountsForSeverityCategory("high"));
        Assert.assertEquals(Arrays.asList(0, 2, 0, 2, 0), table.getCountsForSeverityCategory("medium"));
        Assert.assertEquals(Arrays.asList(0, 0, 0, 0, 100), table.getCountsForSeverityCategory("low"));
    }

    private VulnerabilityMetaData createVMDUnmodifiedSeverity(String status, String severity, String... cert) {
        VulnerabilityMetaData vmd = new VulnerabilityMetaData();

        vmd.set(VulnerabilityMetaData.Attribute.STATUS, status);
        vmd.set("CVSS Unmodified Severity (v3)", severity);
        JSONArray certs = new JSONArray();
        for (String c : cert) {
            certs.put(new JSONObject().put("source", c));
        }
        vmd.set("Advisories", certs.toString());

        return vmd;
    }

    private VulnerabilityMetaData createVMDMultipleSeverities(String status, String severityUnmodified, String severityModified, String... cert) {
        VulnerabilityMetaData vmd = new VulnerabilityMetaData();

        vmd.set(VulnerabilityMetaData.Attribute.STATUS, status);
        vmd.set("CVSS Unmodified Severity (v3)", severityUnmodified);
        vmd.set("CVSS Modified Severity (v3)", severityModified);
        JSONArray certs = new JSONArray();
        for (String c : cert) {
            certs.put(new JSONObject().put("source", c));
        }
        vmd.set("Advisories", certs.toString());

        return vmd;
    }

    @Test
    public void getFurtherAbstractedVulnerabilityCategoryTest() {
        VulnerabilityReportAdapter adapter = new VulnerabilityReportAdapter(new Inventory());

        Assert.assertEquals("potentially affected", adapter.getFurtherAbstractedVulnerabilityCategory(null));
        Assert.assertEquals("potentially affected", adapter.getFurtherAbstractedVulnerabilityCategory(""));
        Assert.assertEquals("potentially affected", adapter.getFurtherAbstractedVulnerabilityCategory("in review"));

        Assert.assertEquals("affected", adapter.getFurtherAbstractedVulnerabilityCategory(VulnerabilityMetaData.STATUS_VALUE_APPLICABLE));

        Assert.assertEquals("not affected", adapter.getFurtherAbstractedVulnerabilityCategory(VulnerabilityMetaData.STATUS_VALUE_NOTAPPLICABLE));
        Assert.assertEquals("not affected", adapter.getFurtherAbstractedVulnerabilityCategory(VulnerabilityMetaData.STATUS_VALUE_VOID));
    }
}
{'fraction_non_alphanumeric': 0.11891891891891893, 'fraction_numerical': 0.008518918918918919, 'mean_word_length': 4.576561369664818, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1470782', 'n_tokens_mistral': 6647, 'n_tokens_neox': 6413, 'n_words': 1026}