use of com.checkmarx.sdk.service.FilterValidator in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class CxGoFilterValidatorTest method verifyScoreFilter.
private void verifyScoreFilter(Double valueToCheck, String valueFromFilter, boolean shouldPass) {
Filter score = Filter.builder().type(Filter.Type.SCORE).value(valueFromFilter).build();
EngineFilterConfiguration scaFilterConfig = EngineFilterConfiguration.builder().simpleFilters(Collections.singletonList(score)).build();
FilterInput input = FilterInput.builder().id("424").score(valueToCheck).build();
String message = String.format("Unexpected score filter result (valueToCheck: %f, valueFromFilter: %s)", valueToCheck, valueFromFilter);
boolean actuallyPassed = new FilterValidator().passesFilter(input, scaFilterConfig);
Assert.assertEquals(message, shouldPass, actuallyPassed);
}
use of com.checkmarx.sdk.service.FilterValidator in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class CxGoFilterValidatorTest method verifyScriptResult.
private static void verifyScriptResult(Script script, String severity, String status, String state, String category, String cweId, boolean expectedResult) {
FilterInput finding = createFilterInput(severity, category, status, state, cweId);
EngineFilterConfiguration filterConfiguration = createFilterConfiguration(script);
FilterValidator validator = new FilterValidator();
boolean actualResult = validator.passesFilter(finding, filterConfiguration);
assertEquals(expectedResult, actualResult, "Unexpected script filtering result.");
}
Aggregations