Search in sources :

Example 6 with Configuration

use of org.zaproxy.zap.extension.script.ScriptsCache.Configuration in project zaproxy by zaproxy.

the class ProxyListenerScriptUnitTest method shouldCreateScriptsCacheWithExpectedConfiguration.

@Test
@SuppressWarnings("unchecked")
void shouldCreateScriptsCacheWithExpectedConfiguration() {
    // Given / When
    new ProxyListenerScript(extensionScript);
    // Then
    ArgumentCaptor<Configuration<ProxyScript>> argumentCaptor = ArgumentCaptor.forClass(Configuration.class);
    verify(extensionScript).createScriptsCache(argumentCaptor.capture());
    Configuration<ProxyScript> configuration = argumentCaptor.getValue();
    assertThat(configuration.getScriptType(), is(equalTo(SCRIPT_TYPE)));
    assertThat(configuration.getTargetInterface(), is(equalTo(TARGET_INTERFACE)));
    InterfaceErrorMessageProvider errorMessageProvider = configuration.getInterfaceErrorMessageProvider();
    assertThat(errorMessageProvider, is(not(nullValue())));
    assertThat(errorMessageProvider.getErrorMessage(null), is(not(nullValue())));
}
Also used : InterfaceErrorMessageProvider(org.zaproxy.zap.extension.script.ScriptsCache.InterfaceErrorMessageProvider) Configuration(org.zaproxy.zap.extension.script.ScriptsCache.Configuration) Test(org.junit.jupiter.api.Test) WithConfigsTest(org.zaproxy.zap.WithConfigsTest)

Aggregations

Configuration (org.zaproxy.zap.extension.script.ScriptsCache.Configuration)6 Test (org.junit.jupiter.api.Test)5 WithConfigsTest (org.zaproxy.zap.WithConfigsTest)5 InterfaceErrorMessageProvider (org.zaproxy.zap.extension.script.ScriptsCache.InterfaceErrorMessageProvider)4 ScriptWrapper (org.zaproxy.zap.extension.script.ScriptWrapper)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Set (java.util.Set)1 HttpException (org.apache.commons.httpclient.HttpException)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 Constant (org.parosproxy.paros.Constant)1 Control (org.parosproxy.paros.control.Control)1 AbstractAppParamPlugin (org.parosproxy.paros.core.scanner.AbstractAppParamPlugin)1 AlertBuilder (org.parosproxy.paros.core.scanner.AbstractPlugin.AlertBuilder)1 Alert (org.parosproxy.paros.core.scanner.Alert)1 Category (org.parosproxy.paros.core.scanner.Category)1