@@ -0,0 +1,2750 @@
+/*%0A * Zed Attack Proxy (ZAP) and its related class files.%0A *%0A * ZAP is an HTTP/HTTPS proxy for assessing web application security.%0A *%0A * Copyright 2020 The ZAP Development Team%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.zaproxy.zap.extension.ascan.filters;%0A%0Aimport static org.hamcrest.MatcherAssert.assertThat;%0Aimport static org.hamcrest.Matchers.both;%0Aimport static org.hamcrest.Matchers.containsString;%0Aimport static org.hamcrest.Matchers.equalTo;%0Aimport static org.hamcrest.Matchers.is;%0Aimport static org.hamcrest.Matchers.nullValue;%0A%0Aimport org.junit.jupiter.api.Test;%0Aimport org.junit.jupiter.params.ParameterizedTest;%0Aimport org.junit.jupiter.params.provider.NullAndEmptySource;%0Aimport org.junit.jupiter.params.provider.ValueSource;%0A%0A/** Unit test for %7B@link FilterResult%7D. */%0Aclass FilterResultUnitTest %7B%0A%0A    @Test%0A    void shouldHaveNotFilteredInstance() %7B%0A        assertThat(FilterResult.NOT_FILTERED.isFiltered(), is(equalTo(false)));%0A        assertThat(FilterResult.NOT_FILTERED.getReason(), is(nullValue()));%0A    %7D%0A%0A    @ParameterizedTest%0A    @NullAndEmptySource%0A    @ValueSource(strings = %22Reason%22)%0A    void shouldCreateFilterResultWithReason(String reason) %7B%0A        // Given / When%0A        FilterResult filterResult = new FilterResult(reason);%0A        // Then%0A        assertThat(filterResult.isFiltered(), is(equalTo(true)));%0A        assertThat(filterResult.getReason(), is(equalTo(reason)));%0A    %7D%0A%0A    @Test%0A    void shouldContainFilteredValueAndNullReasonInToStringForNotFilteredResult() %7B%0A        // Given / When%0A        String string = FilterResult.NOT_FILTERED.toString();%0A        // Then%0A        assertThat(%0A                string, both(containsString(%22filtered=false%22)).and(containsString(%22reason=null%22)));%0A    %7D%0A%0A    @ParameterizedTest%0A    @NullAndEmptySource%0A    @ValueSource(strings = %22Reason%22)%0A    void shouldContainFilteredValueAndReasonInToStringForFilteredResult(String reason) %7B%0A        // Given%0A        FilterResult filterResult = new FilterResult(reason);%0A        // When%0A        String string = filterResult.toString();%0A        // Then%0A        assertThat(%0A                string,%0A                both(containsString(%22filtered=true%22)).and(containsString(%22reason=%22 + reason)));%0A    %7D%0A%7D%0A

Test FilterResult