|
20 | 20 | package org.zaproxy.zap.extension.ascanrulesBeta;
|
21 | 21 |
|
22 | 22 | import static org.hamcrest.MatcherAssert.assertThat;
|
| 23 | +import static org.hamcrest.Matchers.emptyString; |
23 | 24 | import static org.hamcrest.Matchers.equalTo;
|
| 25 | +import static org.hamcrest.Matchers.hasSize; |
24 | 26 | import static org.hamcrest.Matchers.is;
|
| 27 | +import static org.hamcrest.Matchers.not; |
25 | 28 |
|
| 29 | +import java.util.List; |
26 | 30 | import java.util.Map;
|
27 | 31 | import org.junit.jupiter.api.Test;
|
| 32 | +import org.parosproxy.paros.core.scanner.Alert; |
28 | 33 | import org.zaproxy.addon.commonlib.CommonAlertTag;
|
29 | 34 |
|
30 | 35 | class ExpressionLanguageInjectionScanRuleUnitTest
|
@@ -64,4 +69,18 @@ void shouldReturnExpectedMappings() {
|
64 | 69 | tags.get(CommonAlertTag.WSTG_V42_INPV_11_CODE_INJ.getTag()),
|
65 | 70 | is(equalTo(CommonAlertTag.WSTG_V42_INPV_11_CODE_INJ.getValue())));
|
66 | 71 | }
|
| 72 | + |
| 73 | + @Test |
| 74 | + void shouldHaveExpectedExampleAlert() { |
| 75 | + // Given / When |
| 76 | + List<Alert> alerts = rule.getExampleAlerts(); |
| 77 | + // Then |
| 78 | + assertThat(alerts, hasSize(1)); |
| 79 | + Alert alert = alerts.get(0); |
| 80 | + assertThat(alert.getRisk(), is(equalTo(rule.getRisk()))); |
| 81 | + assertThat(alert.getConfidence(), is(equalTo(Alert.CONFIDENCE_MEDIUM))); |
| 82 | + assertThat(alert.getParam(), is(equalTo("foo"))); |
| 83 | + assertThat(alert.getAttack(), is(not(emptyString()))); |
| 84 | + assertThat(alert.getEvidence(), is(not(emptyString()))); |
| 85 | + } |
67 | 86 | }
|
0 commit comments