Search in sources :

Example 11 with FilterResult

use of org.zaproxy.zap.extension.ascan.filters.FilterResult in project zaproxy by zaproxy.

the class GenericFilterUtilityTest method testIncludeCriteriaWithMoreFilterValues.

@Test
void testIncludeCriteriaWithMoreFilterValues() {
    // Given
    List<String> genericFilterData = new ArrayList<>();
    genericFilterData.add("Dummy");
    genericFilterData.add("Dummy1");
    abstractGenericScanFilter.setFilterData(genericFilterData);
    Set<String> values = new HashSet<>();
    values.add("Dummy");
    // When
    FilterResult filterResult = abstractGenericScanFilter.isFiltered(values);
    // Then
    assertThat(filterResult.isFiltered(), is(false));
}
Also used : ArrayList(java.util.ArrayList) FilterResult(org.zaproxy.zap.extension.ascan.filters.FilterResult) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test) WithConfigsTest(org.zaproxy.zap.WithConfigsTest)

Example 12 with FilterResult

use of org.zaproxy.zap.extension.ascan.filters.FilterResult in project zaproxy by zaproxy.

the class GenericFilterUtilityTest method testShouldFailWhenSameValuesInExcludeCriteria.

@Test
void testShouldFailWhenSameValuesInExcludeCriteria() {
    // Given
    List<String> genericFilterData = new ArrayList<>();
    genericFilterData.add("Dummy");
    abstractGenericScanFilter.setFilterData(genericFilterData);
    abstractGenericScanFilter.setFilterCriteria(FilterCriteria.EXCLUDE);
    Set<String> values = new HashSet<>();
    values.add("Dummy");
    // When
    FilterResult filterResult = abstractGenericScanFilter.isFiltered(values);
    // Then
    assertThat(filterResult.isFiltered(), is(true));
}
Also used : ArrayList(java.util.ArrayList) FilterResult(org.zaproxy.zap.extension.ascan.filters.FilterResult) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test) WithConfigsTest(org.zaproxy.zap.WithConfigsTest)

Example 13 with FilterResult

use of org.zaproxy.zap.extension.ascan.filters.FilterResult in project zaproxy by zaproxy.

the class GenericFilterUtilityTest method testEmptyValuesInExcludeCriteria.

@Test
void testEmptyValuesInExcludeCriteria() {
    // Given
    List<String> genericFilterData = new ArrayList<>();
    genericFilterData.add("Dummy");
    abstractGenericScanFilter.setFilterData(genericFilterData);
    abstractGenericScanFilter.setFilterCriteria(FilterCriteria.EXCLUDE);
    Set<String> values = new HashSet<>();
    // When
    FilterResult filterResult = abstractGenericScanFilter.isFiltered(values);
    // Then
    assertThat(filterResult.isFiltered(), is(false));
}
Also used : ArrayList(java.util.ArrayList) FilterResult(org.zaproxy.zap.extension.ascan.filters.FilterResult) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test) WithConfigsTest(org.zaproxy.zap.WithConfigsTest)

Aggregations

FilterResult (org.zaproxy.zap.extension.ascan.filters.FilterResult)13 Test (org.junit.jupiter.api.Test)11 ArrayList (java.util.ArrayList)10 HashSet (java.util.HashSet)10 WithConfigsTest (org.zaproxy.zap.WithConfigsTest)10 HttpMessage (org.parosproxy.paros.network.HttpMessage)2 ScanFilter (org.zaproxy.zap.extension.ascan.filters.ScanFilter)2 IOException (java.io.IOException)1 DatabaseException (org.parosproxy.paros.db.DatabaseException)1 HttpMalformedHeaderException (org.parosproxy.paros.network.HttpMalformedHeaderException)1 FilterCriteria (org.zaproxy.zap.extension.ascan.filters.FilterCriteria)1 StructuralNode (org.zaproxy.zap.model.StructuralNode)1