use of org.zaproxy.zap.extension.ascan.filters.FilterResult in project zaproxy by zaproxy.
the class GenericFilterUtilityTest method testEmptyFilterValuesIncludeCriteria.
@Test
void testEmptyFilterValuesIncludeCriteria() {
// Given
List<String> genericFilterData = new ArrayList<>();
abstractGenericScanFilter.setFilterData(genericFilterData);
Set<String> values = new HashSet<>();
values.add("Dummy");
// When
FilterResult filterResult = abstractGenericScanFilter.isFiltered(values);
// Then
assertThat(filterResult.isFiltered(), is(false));
}
use of org.zaproxy.zap.extension.ascan.filters.FilterResult in project zaproxy by zaproxy.
the class GenericFilterUtilityTest method testIncludeCriteriaWithMoreValues.
@Test
void testIncludeCriteriaWithMoreValues() {
// Given
List<String> genericFilterData = new ArrayList<>();
genericFilterData.add("Dummy");
abstractGenericScanFilter.setFilterData(genericFilterData);
Set<String> values = new HashSet<>();
values.add("Dummy");
values.add("Dummy1");
// When
FilterResult filterResult = abstractGenericScanFilter.isFiltered(values);
// Then
assertThat(filterResult.isFiltered(), is(false));
}
use of org.zaproxy.zap.extension.ascan.filters.FilterResult in project zaproxy by zaproxy.
the class GenericFilterUtilityTest method testShouldFailWhenValuesAndFilterDataValuesMismatchIncludeCriteria.
@Test
void testShouldFailWhenValuesAndFilterDataValuesMismatchIncludeCriteria() {
// Given
List<String> genericFilterData = new ArrayList<>();
genericFilterData.add("Dummy");
abstractGenericScanFilter.setFilterData(genericFilterData);
Set<String> values = new HashSet<>();
values.add("Dummy1");
// When
FilterResult filterResult = abstractGenericScanFilter.isFiltered(values);
// Then
assertThat(filterResult.isFiltered(), is(true));
}
use of org.zaproxy.zap.extension.ascan.filters.FilterResult in project zaproxy by zaproxy.
the class GenericFilterUtilityTest method testShouldFailInExcludeCriteriaWithMoreFilterValues.
@Test
void testShouldFailInExcludeCriteriaWithMoreFilterValues() {
// Given
List<String> genericFilterData = new ArrayList<>();
genericFilterData.add("Dummy");
genericFilterData.add("Dummy1");
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));
}
use of org.zaproxy.zap.extension.ascan.filters.FilterResult in project zaproxy by zaproxy.
the class GenericFilterUtilityTest method testShouldPassForValuesAndFilterValuesMismatchInExcludeCriteria.
@Test
void testShouldPassForValuesAndFilterValuesMismatchInExcludeCriteria() {
// Given
List<String> genericFilterData = new ArrayList<>();
genericFilterData.add("Dummy");
abstractGenericScanFilter.setFilterData(genericFilterData);
abstractGenericScanFilter.setFilterCriteria(FilterCriteria.EXCLUDE);
Set<String> values = new HashSet<>();
values.add("Dummy1");
// When
FilterResult filterResult = abstractGenericScanFilter.isFiltered(values);
// Then
assertThat(filterResult.isFiltered(), is(false));
}
Aggregations