|
| 1 | +/* |
| 2 | + * Zed Attack Proxy (ZAP) and its related class files. |
| 3 | + * |
| 4 | + * ZAP is an HTTP/HTTPS proxy for assessing web application security. |
| 5 | + * |
| 6 | + * Copyright 2024 The ZAP Development Team |
| 7 | + * |
| 8 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | + * you may not use this file except in compliance with the License. |
| 10 | + * You may obtain a copy of the License at |
| 11 | + * |
| 12 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | + * |
| 14 | + * Unless required by applicable law or agreed to in writing, software |
| 15 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | + * See the License for the specific language governing permissions and |
| 18 | + * limitations under the License. |
| 19 | + */ |
| 20 | +package org.zaproxy.zap.extension.ascanrulesAlpha; |
| 21 | + |
| 22 | +import static org.hamcrest.MatcherAssert.assertThat; |
| 23 | +import static org.hamcrest.Matchers.endsWith; |
| 24 | +import static org.hamcrest.Matchers.equalTo; |
| 25 | +import static org.hamcrest.Matchers.hasSize; |
| 26 | +import static org.hamcrest.Matchers.is; |
| 27 | + |
| 28 | +import java.util.List; |
| 29 | +import org.junit.jupiter.api.Test; |
| 30 | +import org.parosproxy.paros.core.scanner.Alert; |
| 31 | + |
| 32 | +public class ExampleSimpleActiveScanRuleUnitTest |
| 33 | + extends ActiveScannerTest<ExampleSimpleActiveScanRule> { |
| 34 | + |
| 35 | + @Override |
| 36 | + protected ExampleSimpleActiveScanRule createScanner() { |
| 37 | + return new ExampleSimpleActiveScanRule(); |
| 38 | + } |
| 39 | + |
| 40 | + @Test |
| 41 | + void shouldHaveExpectedExample() { |
| 42 | + // Given / When |
| 43 | + List<Alert> alerts = rule.getExampleAlerts(); |
| 44 | + // Then |
| 45 | + assertThat(alerts, hasSize(1)); |
| 46 | + Alert alert = alerts.get(0); |
| 47 | + assertThat(alert.getParam(), is(equalTo("foo"))); |
| 48 | + } |
| 49 | + |
| 50 | + @Test |
| 51 | + void shouldHaveHelpLink() { |
| 52 | + // Given / When |
| 53 | + String helplink = rule.getHelpLink(); |
| 54 | + // Then |
| 55 | + assertThat(helplink, endsWith("60100")); |
| 56 | + } |
| 57 | + |
| 58 | + @Test |
| 59 | + @Override |
| 60 | + public void shouldHaveValidReferences() { |
| 61 | + super.shouldHaveValidReferences(); |
| 62 | + } |
| 63 | +} |
0 commit comments