use of org.junit.jupiter.params.provider.ValueSource in project zaproxy by zaproxy.
the class Log4jHomeConfigurationTest method shouldHaveCrawljaxChattyClassesSetToWarn.
@ParameterizedTest
@ValueSource(strings = { "com.crawljax.core.Crawler", "com.crawljax.core.state.StateMachine", "com.crawljax.core.UnfiredCandidateActions" })
void shouldHaveCrawljaxChattyClassesSetToWarn(String nname) {
// Given / When
LoggerConfig loggerConfig = configuration.getLoggerConfig(nname);
// Then
assertThat(loggerConfig, is(notNullValue()));
assertThat(loggerConfig.getLevel(), is(equalTo(Level.WARN)));
}
use of org.junit.jupiter.params.provider.ValueSource in project zaproxy by zaproxy.
the class SocksProxyUnitTest method shouldGetSocks5FromInvalidValues.
@ParameterizedTest
@NullAndEmptySource
@ValueSource(strings = { "3", "NotAVersion" })
void shouldGetSocks5FromInvalidValues(String value) {
// Given value
// When
Version version = Version.from(value);
// Then
assertThat(version, is(equalTo(Version.SOCKS5)));
}
use of org.junit.jupiter.params.provider.ValueSource in project zaproxy by zaproxy.
the class FilterResultUnitTest method shouldContainFilteredValueAndReasonInToStringForFilteredResult.
@ParameterizedTest
@NullAndEmptySource
@ValueSource(strings = "Reason")
void shouldContainFilteredValueAndReasonInToStringForFilteredResult(String reason) {
// Given
FilterResult filterResult = new FilterResult(reason);
// When
String string = filterResult.toString();
// Then
assertThat(string, both(containsString("filtered=true")).and(containsString("reason=" + reason)));
}
use of org.junit.jupiter.params.provider.ValueSource in project zaproxy by zaproxy.
the class BreakpointMessageHandler2UnitTest method shouldBeBreakpointIfStepping.
@ParameterizedTest
@ValueSource(strings = { "true", "false" })
void shouldBeBreakpointIfStepping(boolean request) {
// Given
Message message = mock(Message.class);
given(breakpointManagementInterface.isStepping()).willReturn(true);
// When
boolean breakpoint = breakpointMessageHandler.isBreakpoint(message, request, false);
// Then
assertThat(breakpoint, is(equalTo(true)));
}
use of org.junit.jupiter.params.provider.ValueSource in project zaproxy by zaproxy.
the class BreakpointMessageHandler2UnitTest method shouldNotBeBreakpointIfIgnoreRuleMatch.
@ParameterizedTest
@ValueSource(strings = { "true", "false" })
void shouldNotBeBreakpointIfIgnoreRuleMatch(boolean request) {
// Given
Message message = mock(Message.class);
given(message.isInScope()).willReturn(true);
given(breakpointManagementInterface.isBreakRequest()).willReturn(true);
given(breakpointManagementInterface.isBreakResponse()).willReturn(true);
BreakpointMessageInterface skipBreakpoint = mock(BreakpointMessageInterface.class);
given(skipBreakpoint.isEnabled()).willReturn(true);
given(skipBreakpoint.match(message, request, false)).willReturn(true);
List<BreakpointMessageInterface> ignoreRules = Arrays.asList(skipBreakpoint);
breakpointMessageHandler.setEnabledIgnoreRules(ignoreRules);
// When
boolean breakpoint = breakpointMessageHandler.isBreakpoint(message, request, false);
// Then
assertThat(breakpoint, is(equalTo(false)));
}
Aggregations