use of org.zaproxy.zap.extension.script.ScriptsCache.InterfaceErrorMessageProvider in project zaproxy by zaproxy.
the class ScriptsPassiveScannerUnitTest method shouldCreateScriptsCacheWithExpectedConfiguration.
@Test
@SuppressWarnings("unchecked")
void shouldCreateScriptsCacheWithExpectedConfiguration() {
// Given / When
new ScriptsPassiveScanner();
// Then
ArgumentCaptor<Configuration<PassiveScript>> argumentCaptor = ArgumentCaptor.forClass(Configuration.class);
verify(extensionScript).createScriptsCache(argumentCaptor.capture());
Configuration<PassiveScript> 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())));
ScriptWrapper scriptWrapper = mock(ScriptWrapper.class);
given(scriptWrapper.getName()).willReturn("Name");
assertThat(errorMessageProvider.getErrorMessage(scriptWrapper), is(not(nullValue())));
}
use of org.zaproxy.zap.extension.script.ScriptsCache.InterfaceErrorMessageProvider in project zaproxy by zaproxy.
the class HttpSenderScriptListenerUnitTest method shouldCreateScriptsCacheWithExpectedConfiguration.
@Test
@SuppressWarnings("unchecked")
void shouldCreateScriptsCacheWithExpectedConfiguration() {
// Given / When
new HttpSenderScriptListener(extensionScript);
// Then
ArgumentCaptor<Configuration<HttpSenderScript>> argumentCaptor = ArgumentCaptor.forClass(Configuration.class);
verify(extensionScript).createScriptsCache(argumentCaptor.capture());
Configuration<HttpSenderScript> 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())));
}
use of org.zaproxy.zap.extension.script.ScriptsCache.InterfaceErrorMessageProvider in project zaproxy by zaproxy.
the class VariantFactoryUnitTest method shouldCreateScriptsCacheWithExpectedConfiguration.
@Test
@SuppressWarnings("unchecked")
void shouldCreateScriptsCacheWithExpectedConfiguration() {
// Given / When
factory.createSiteModifyingVariants();
// Then
ArgumentCaptor<Configuration<VariantScript>> argumentCaptor = ArgumentCaptor.forClass(Configuration.class);
verify(extensionScript).createScriptsCache(argumentCaptor.capture());
Configuration<VariantScript> 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(mock(ScriptWrapper.class)), is(not(nullValue())));
}
use of org.zaproxy.zap.extension.script.ScriptsCache.InterfaceErrorMessageProvider 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())));
}
Aggregations