Search in sources :

Example 31 with Alert

use of org.parosproxy.paros.core.scanner.Alert in project zaproxy by zaproxy.

the class ExtensionAlertUnitTest method shouldReplaceAlertOtherCorrectly.

@Test
public void shouldReplaceAlertOtherCorrectly() {
    extAlert.setAlertOverrideProperty("1.otherInfo", NEW_OTHER);
    Alert alert1 = newAlert(1);
    extAlert.applyOverrides(alert1);
    // When/Then
    assertEquals(ORIGINAL_NAME, alert1.getName());
    assertEquals(ORIGINAL_DESC, alert1.getDescription());
    assertEquals(ORIGINAL_SOLN, alert1.getSolution());
    assertEquals(NEW_OTHER, alert1.getOtherInfo());
    assertEquals(ORIGINAL_REF, alert1.getReference());
    // Check other alerts are not affected
    Alert alert2 = newAlert(2);
    extAlert.applyOverrides(alert2);
    // When/Then
    assertEquals(ORIGINAL_NAME, alert2.getName());
    assertEquals(ORIGINAL_DESC, alert2.getDescription());
    assertEquals(ORIGINAL_SOLN, alert2.getSolution());
    assertEquals(ORIGINAL_OTHER, alert2.getOtherInfo());
    assertEquals(ORIGINAL_REF, alert2.getReference());
}
Also used : Alert(org.parosproxy.paros.core.scanner.Alert) Test(org.junit.Test)

Example 32 with Alert

use of org.parosproxy.paros.core.scanner.Alert in project zaproxy by zaproxy.

the class ExtensionAlertUnitTest method shouldAppendAlertOtherCorrectly.

@Test
public void shouldAppendAlertOtherCorrectly() {
    extAlert.setAlertOverrideProperty("1.otherInfo", "+" + NEW_OTHER);
    Alert alert1 = newAlert(1);
    extAlert.applyOverrides(alert1);
    // When/Then
    assertEquals(ORIGINAL_NAME, alert1.getName());
    assertEquals(ORIGINAL_DESC, alert1.getDescription());
    assertEquals(ORIGINAL_SOLN, alert1.getSolution());
    assertEquals(ORIGINAL_OTHER + NEW_OTHER, alert1.getOtherInfo());
    assertEquals(ORIGINAL_REF, alert1.getReference());
    // Check other alerts are not affected
    Alert alert2 = newAlert(2);
    extAlert.applyOverrides(alert2);
    // When/Then
    assertEquals(ORIGINAL_NAME, alert2.getName());
    assertEquals(ORIGINAL_DESC, alert2.getDescription());
    assertEquals(ORIGINAL_SOLN, alert2.getSolution());
    assertEquals(ORIGINAL_OTHER, alert2.getOtherInfo());
    assertEquals(ORIGINAL_REF, alert2.getReference());
}
Also used : Alert(org.parosproxy.paros.core.scanner.Alert) Test(org.junit.Test)

Example 33 with Alert

use of org.parosproxy.paros.core.scanner.Alert in project zaproxy by zaproxy.

the class ExtensionAlertUnitTest method shouldAppendAlertRefCorrectly.

@Test
public void shouldAppendAlertRefCorrectly() {
    extAlert.setAlertOverrideProperty("1.reference", "+" + NEW_REF);
    Alert alert1 = newAlert(1);
    extAlert.applyOverrides(alert1);
    // When/Then
    assertEquals(ORIGINAL_NAME, alert1.getName());
    assertEquals(ORIGINAL_DESC, alert1.getDescription());
    assertEquals(ORIGINAL_SOLN, alert1.getSolution());
    assertEquals(ORIGINAL_OTHER, alert1.getOtherInfo());
    assertEquals(ORIGINAL_REF + NEW_REF, alert1.getReference());
    // Check other alerts are not affected
    Alert alert2 = newAlert(2);
    extAlert.applyOverrides(alert2);
    // When/Then
    assertEquals(ORIGINAL_NAME, alert2.getName());
    assertEquals(ORIGINAL_DESC, alert2.getDescription());
    assertEquals(ORIGINAL_SOLN, alert2.getSolution());
    assertEquals(ORIGINAL_OTHER, alert2.getOtherInfo());
    assertEquals(ORIGINAL_REF, alert2.getReference());
}
Also used : Alert(org.parosproxy.paros.core.scanner.Alert) Test(org.junit.Test)

Example 34 with Alert

use of org.parosproxy.paros.core.scanner.Alert in project zaproxy by zaproxy.

the class ExtensionAlertUnitTest method shouldPrependAlertOtherCorrectly.

@Test
public void shouldPrependAlertOtherCorrectly() {
    extAlert.setAlertOverrideProperty("1.otherInfo", "-" + NEW_OTHER);
    Alert alert1 = newAlert(1);
    extAlert.applyOverrides(alert1);
    // When/Then
    assertEquals(ORIGINAL_NAME, alert1.getName());
    assertEquals(ORIGINAL_DESC, alert1.getDescription());
    assertEquals(ORIGINAL_SOLN, alert1.getSolution());
    assertEquals(NEW_OTHER + ORIGINAL_OTHER, alert1.getOtherInfo());
    assertEquals(ORIGINAL_REF, alert1.getReference());
    // Check other alerts are not affected
    Alert alert2 = newAlert(2);
    extAlert.applyOverrides(alert2);
    // When/Then
    assertEquals(ORIGINAL_NAME, alert2.getName());
    assertEquals(ORIGINAL_DESC, alert2.getDescription());
    assertEquals(ORIGINAL_SOLN, alert2.getSolution());
    assertEquals(ORIGINAL_OTHER, alert2.getOtherInfo());
    assertEquals(ORIGINAL_REF, alert2.getReference());
}
Also used : Alert(org.parosproxy.paros.core.scanner.Alert) Test(org.junit.Test)

Example 35 with Alert

use of org.parosproxy.paros.core.scanner.Alert in project zaproxy by zaproxy.

the class ExtensionAlertUnitTest method shouldReplaceAlertNameCorrectly.

@Test
public void shouldReplaceAlertNameCorrectly() {
    extAlert.setAlertOverrideProperty("1.name", NEW_NAME);
    Alert alert1 = newAlert(1);
    extAlert.applyOverrides(alert1);
    // When/Then
    assertEquals(NEW_NAME, alert1.getName());
    assertEquals(ORIGINAL_DESC, alert1.getDescription());
    assertEquals(ORIGINAL_SOLN, alert1.getSolution());
    assertEquals(ORIGINAL_OTHER, alert1.getOtherInfo());
    assertEquals(ORIGINAL_REF, alert1.getReference());
    // Check other alerts are not affected
    Alert alert2 = newAlert(2);
    extAlert.applyOverrides(alert2);
    // When/Then
    assertEquals(ORIGINAL_NAME, alert2.getName());
    assertEquals(ORIGINAL_DESC, alert2.getDescription());
    assertEquals(ORIGINAL_SOLN, alert2.getSolution());
    assertEquals(ORIGINAL_OTHER, alert2.getOtherInfo());
    assertEquals(ORIGINAL_REF, alert2.getReference());
}
Also used : Alert(org.parosproxy.paros.core.scanner.Alert) Test(org.junit.Test)

Aggregations

Alert (org.parosproxy.paros.core.scanner.Alert)37 Test (org.junit.Test)15 ArrayList (java.util.ArrayList)7 RecordAlert (org.parosproxy.paros.db.RecordAlert)7 TableAlert (org.parosproxy.paros.db.TableAlert)7 HistoryReference (org.parosproxy.paros.model.HistoryReference)6 SiteNode (org.parosproxy.paros.model.SiteNode)6 ExtensionAlert (org.zaproxy.zap.extension.alert.ExtensionAlert)5 DatabaseException (org.parosproxy.paros.db.DatabaseException)4 TreePath (javax.swing.tree.TreePath)3 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 Session (org.parosproxy.paros.model.Session)2 SiteMap (org.parosproxy.paros.model.SiteMap)2 AlertNode (org.zaproxy.zap.extension.alert.AlertNode)2 Component (java.awt.Component)1 Dimension (java.awt.Dimension)1 HeadlessException (java.awt.HeadlessException)1 Point (java.awt.Point)1 MouseEvent (java.awt.event.MouseEvent)1 Enumeration (java.util.Enumeration)1