Search in sources :

Example 46 with ValueSource

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)));
}
Also used : LoggerConfig(org.apache.logging.log4j.core.config.LoggerConfig) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 47 with ValueSource

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)));
}
Also used : Version(org.zaproxy.zap.network.SocksProxy.Version) NullAndEmptySource(org.junit.jupiter.params.provider.NullAndEmptySource) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 48 with ValueSource

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)));
}
Also used : Matchers.containsString(org.hamcrest.Matchers.containsString) NullAndEmptySource(org.junit.jupiter.params.provider.NullAndEmptySource) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 49 with ValueSource

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)));
}
Also used : Message(org.zaproxy.zap.extension.httppanel.Message) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 50 with ValueSource

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)));
}
Also used : Message(org.zaproxy.zap.extension.httppanel.Message) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)266 ValueSource (org.junit.jupiter.params.provider.ValueSource)266 HashSet (java.util.HashSet)23 HistogramTestUtils.constructDoubleHistogram (org.HdrHistogram.HistogramTestUtils.constructDoubleHistogram)23 ArrayList (java.util.ArrayList)22 HashMap (java.util.HashMap)20 ApiResponse (org.hisp.dhis.dto.ApiResponse)15 UpdateModel (com.synopsys.integration.alert.update.model.UpdateModel)13 File (java.io.File)13 List (java.util.List)13 OffsetDateTime (java.time.OffsetDateTime)10 Map (java.util.Map)10 TimeUnit (java.util.concurrent.TimeUnit)10 TopicPartition (org.apache.kafka.common.TopicPartition)9 ListenerSubscribeMessage (io.nem.symbol.sdk.infrastructure.ListenerSubscribeMessage)8 UnresolvedAddress (io.nem.symbol.sdk.model.account.UnresolvedAddress)8 ZooKeeper (org.apache.zookeeper.ZooKeeper)8 JsonObject (com.google.gson.JsonObject)7 IOException (java.io.IOException)7 CountDownLatch (java.util.concurrent.CountDownLatch)7