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)));
}
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));
}
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)));
}
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());
}
}
}
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));
}
Aggregations