use of org.zaproxy.zap.extension.script.ExtensionScript in project zaproxy by zaproxy.
the class VariantCustomUnitTest method shouldReturnNullLeafNameWithScriptException.
@Test
void shouldReturnNullLeafNameWithScriptException() throws Exception {
// Given
ScriptWrapper scriptWrapper = mock(ScriptWrapper.class);
String nodeName = "name";
ExtensionScript extScript = mock(ExtensionScript.class);
VariantScript variantScript = mock(VariantScript.class);
given(extScript.getInterface(scriptWrapper, VariantScript.class)).willReturn(variantScript);
VariantCustom variantCustom = new VariantCustom(scriptWrapper, extScript);
HttpMessage msg = mock(HttpMessage.class);
given(variantScript.getLeafName(variantCustom, nodeName, msg)).willThrow(RuntimeException.class);
// When
String name = variantCustom.getLeafName(nodeName, msg);
// Then
assertThat(name, is(equalTo(null)));
}
Aggregations