use of org.junit.jupiter.params.provider.Arguments in project junit5 by junit-team.
the class ParameterizedTestExtensionTests method argumentsRethrowsOriginalExceptionFromProviderAsUncheckedException.
@Test
void argumentsRethrowsOriginalExceptionFromProviderAsUncheckedException() {
ArgumentsProvider failingProvider = (context) -> {
throw new FileNotFoundException("a message");
};
FileNotFoundException exception = assertThrows(FileNotFoundException.class, () -> arguments(failingProvider, null));
assertEquals("a message", exception.getMessage());
}
use of org.junit.jupiter.params.provider.Arguments in project kafka by apache.
the class MockProcessorContextStateStoreTest method parameters.
public static Stream<Arguments> parameters() {
final List<Boolean> booleans = asList(true, false);
final List<Arguments> values = new ArrayList<>();
for (final Boolean timestamped : booleans) {
for (final Boolean caching : booleans) {
for (final Boolean logging : booleans) {
final List<KeyValueBytesStoreSupplier> keyValueBytesStoreSuppliers = asList(Stores.inMemoryKeyValueStore("kv" + timestamped + caching + logging), Stores.persistentKeyValueStore("kv" + timestamped + caching + logging), Stores.persistentTimestampedKeyValueStore("kv" + timestamped + caching + logging));
for (final KeyValueBytesStoreSupplier supplier : keyValueBytesStoreSuppliers) {
final StoreBuilder<? extends KeyValueStore<String, ?>> builder;
if (timestamped) {
builder = Stores.timestampedKeyValueStoreBuilder(supplier, Serdes.String(), Serdes.Long());
} else {
builder = Stores.keyValueStoreBuilder(supplier, Serdes.String(), Serdes.Long());
}
if (caching) {
builder.withCachingEnabled();
} else {
builder.withCachingDisabled();
}
if (logging) {
builder.withLoggingEnabled(Collections.emptyMap());
} else {
builder.withLoggingDisabled();
}
values.add(Arguments.of(builder, timestamped, caching, logging));
}
}
}
}
for (final Boolean timestamped : booleans) {
for (final Boolean caching : booleans) {
for (final Boolean logging : booleans) {
final List<WindowBytesStoreSupplier> windowBytesStoreSuppliers = asList(Stores.inMemoryWindowStore("w" + timestamped + caching + logging, Duration.ofSeconds(1), Duration.ofSeconds(1), false), Stores.persistentWindowStore("w" + timestamped + caching + logging, Duration.ofSeconds(1), Duration.ofSeconds(1), false), Stores.persistentTimestampedWindowStore("w" + timestamped + caching + logging, Duration.ofSeconds(1), Duration.ofSeconds(1), false));
for (final WindowBytesStoreSupplier supplier : windowBytesStoreSuppliers) {
final StoreBuilder<? extends WindowStore<String, ?>> builder;
if (timestamped) {
builder = Stores.timestampedWindowStoreBuilder(supplier, Serdes.String(), Serdes.Long());
} else {
builder = Stores.windowStoreBuilder(supplier, Serdes.String(), Serdes.Long());
}
if (caching) {
builder.withCachingEnabled();
} else {
builder.withCachingDisabled();
}
if (logging) {
builder.withLoggingEnabled(Collections.emptyMap());
} else {
builder.withLoggingDisabled();
}
values.add(Arguments.of(builder, timestamped, caching, logging));
}
}
}
}
for (final Boolean caching : booleans) {
for (final Boolean logging : booleans) {
final List<SessionBytesStoreSupplier> sessionBytesStoreSuppliers = asList(Stores.inMemorySessionStore("s" + caching + logging, Duration.ofSeconds(1)), Stores.persistentSessionStore("s" + caching + logging, Duration.ofSeconds(1)));
for (final SessionBytesStoreSupplier supplier : sessionBytesStoreSuppliers) {
final StoreBuilder<? extends SessionStore<String, ?>> builder = Stores.sessionStoreBuilder(supplier, Serdes.String(), Serdes.Long());
if (caching) {
builder.withCachingEnabled();
} else {
builder.withCachingDisabled();
}
if (logging) {
builder.withLoggingEnabled(Collections.emptyMap());
} else {
builder.withLoggingDisabled();
}
values.add(Arguments.of(builder, false, caching, logging));
}
}
}
return values.stream();
}
use of org.junit.jupiter.params.provider.Arguments in project zookeeper by apache.
the class UnifiedServerSocketTest method data.
public static Stream<Arguments> data() {
ArrayList<Arguments> result = new ArrayList<>();
int paramIndex = 0;
for (X509KeyType caKeyType : X509KeyType.values()) {
for (X509KeyType certKeyType : X509KeyType.values()) {
for (Boolean hostnameVerification : new Boolean[] { true, false }) {
result.add(Arguments.of(caKeyType, certKeyType, hostnameVerification, paramIndex++));
}
}
}
return result.stream();
}
use of org.junit.jupiter.params.provider.Arguments in project scylla by bptlab.
the class SeedProvider method provideArguments.
@Override
public Stream<? extends Arguments> provideArguments(ExtensionContext context) throws Exception {
Random random = new Random();
Long randomSeed = random.nextLong();
List<Long> randomRun = new ArrayList<>();
randomRun.add(randomSeed);
return Stream.concat(Arrays.stream(seeds).boxed(), randomRun.stream()).map(Arguments::of);
}
use of org.junit.jupiter.params.provider.Arguments in project janusgraph by JanusGraph.
the class IDAuthorityTest method configs.
public static Stream<Arguments> configs() {
final List<Arguments> configurations = new ArrayList<>();
ModifiableConfiguration c = getBasicConfig();
configurations.add(arguments(checkAndReturnWriteConfiguration(c)));
c = getBasicConfig();
c.set(IDAUTHORITY_CAV_BITS, 9);
c.set(IDAUTHORITY_CAV_TAG, 511);
configurations.add(arguments(checkAndReturnWriteConfiguration(c)));
c = getBasicConfig();
c.set(IDAUTHORITY_CAV_RETRIES, 10);
c.set(IDAUTHORITY_WAIT, Duration.ofMillis(10L));
c.set(IDAUTHORITY_CAV_BITS, 7);
// c.set(IDAUTHORITY_RANDOMIZE_UNIQUEID,true);
c.set(IDAUTHORITY_CONFLICT_AVOIDANCE, ConflictAvoidanceMode.GLOBAL_AUTO);
configurations.add(arguments(checkAndReturnWriteConfiguration(c)));
return configurations.stream();
}
Aggregations