Search in sources :

Example 1 with NullAndEmptySource

use of org.junit.jupiter.params.provider.NullAndEmptySource 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 2 with NullAndEmptySource

use of org.junit.jupiter.params.provider.NullAndEmptySource in project zaproxy by zaproxy.

the class HttpPanelComponentViewsManagerGuiTest method shouldThrowExceptionWhenAddingViewWithInvalidCaption.

@ParameterizedTest
@NullAndEmptySource
void shouldThrowExceptionWhenAddingViewWithInvalidCaption(String caption) {
    // Given
    HttpPanelView view = createHttpPanelView(VIEW_NAME, caption);
    // When / Then
    assertThrows(IllegalArgumentException.class, () -> manager.addView(view));
}
Also used : HttpPanelView(org.zaproxy.zap.extension.httppanel.view.HttpPanelView) NullAndEmptySource(org.junit.jupiter.params.provider.NullAndEmptySource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with NullAndEmptySource

use of org.junit.jupiter.params.provider.NullAndEmptySource 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 4 with NullAndEmptySource

use of org.junit.jupiter.params.provider.NullAndEmptySource in project Aeron by real-logic.

the class AgentTests method agentmainShouldUseSystemPropertiesWhenAgentsArgsIsEmpty.

@ParameterizedTest
@NullAndEmptySource
void agentmainShouldUseSystemPropertiesWhenAgentsArgsIsEmpty(final String agentArgs) {
    System.setProperty(ENABLED_DRIVER_EVENT_CODES.propertyName(), "admin");
    System.setProperty(ENABLED_ARCHIVE_EVENT_CODES.propertyName(), "CMD_IN_EXTEND_RECORDING,REPLICATION_SESSION_STATE_CHANGE,CATALOG_RESIZE");
    System.setProperty(DISABLED_ARCHIVE_EVENT_CODES.propertyName(), "REPLICATION_SESSION_STATE_CHANGE");
    System.setProperty(ENABLED_CLUSTER_EVENT_CODES.propertyName(), "all");
    System.setProperty(DISABLED_CLUSTER_EVENT_CODES.propertyName(), "ROLE_CHANGE");
    System.setProperty(READER_CLASSNAME.propertyName(), TestLoggingAgent.class.getName());
    final int instanceCount = TestLoggingAgent.INSTANCE_COUNT.get();
    try {
        EventLogAgent.agentmain(agentArgs, ByteBuddyAgent.install());
        assertEquals(instanceCount + 1, TestLoggingAgent.INSTANCE_COUNT.get());
        assertEquals(ADMIN_ONLY_EVENT_CODES, DRIVER_EVENT_CODES);
        assertEquals(EnumSet.of(ArchiveEventCode.CMD_IN_EXTEND_RECORDING, ArchiveEventCode.CATALOG_RESIZE), ARCHIVE_EVENT_CODES);
        assertEquals(EnumSet.complementOf(EnumSet.of(ClusterEventCode.ROLE_CHANGE)), CLUSTER_EVENT_CODES);
    } finally {
        for (final ConfigOption option : ConfigOption.values()) {
            System.clearProperty(option.propertyName());
        }
    }
}
Also used : ConfigOption(io.aeron.agent.ConfigOption) NullAndEmptySource(org.junit.jupiter.params.provider.NullAndEmptySource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 5 with NullAndEmptySource

use of org.junit.jupiter.params.provider.NullAndEmptySource in project zaproxy by zaproxy.

the class HttpPanelComponentViewsManagerGuiTest method shouldThrowExceptionWhenAddingViewWithInvalidName.

@ParameterizedTest
@NullAndEmptySource
void shouldThrowExceptionWhenAddingViewWithInvalidName(String name) {
    // Given
    HttpPanelView view = createHttpPanelView(name);
    // When / Then
    assertThrows(IllegalArgumentException.class, () -> manager.addView(view));
}
Also used : HttpPanelView(org.zaproxy.zap.extension.httppanel.view.HttpPanelView) NullAndEmptySource(org.junit.jupiter.params.provider.NullAndEmptySource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)7 NullAndEmptySource (org.junit.jupiter.params.provider.NullAndEmptySource)7 ValueSource (org.junit.jupiter.params.provider.ValueSource)2 HttpPanelView (org.zaproxy.zap.extension.httppanel.view.HttpPanelView)2 ConfigOption (io.aeron.agent.ConfigOption)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 HttpMessage (org.parosproxy.paros.network.HttpMessage)1 HttpRequestBody (org.zaproxy.zap.network.HttpRequestBody)1 Version (org.zaproxy.zap.network.SocksProxy.Version)1