net.jqwik.engine.properties.arbitraries.SetArbitrary Maven / Gradle / Ivy
package net.jqwik.engine.properties.arbitraries;
import java.util.*;
import net.jqwik.api.*;
import net.jqwik.engine.properties.arbitraries.exhaustive.*;
import net.jqwik.engine.properties.arbitraries.randomized.*;
public class SetArbitrary extends DefaultCollectionArbitrary> {
public SetArbitrary(Arbitrary elementArbitrary) {
super(elementArbitrary);
}
@Override
public RandomGenerator> generator(int genSize) {
int cutoffSize = cutoffSize(genSize);
RandomGenerator elementGenerator = elementGenerator(elementArbitrary, genSize);
List>> samples = edgeCases(new HashSet<>());
return RandomGenerators.set(elementGenerator, minSize, maxSize, cutoffSize).withEdgeCases(genSize, samples);
}
@Override
public Optional>> exhaustive() {
return ExhaustiveGenerators.set(elementArbitrary, minSize, maxSize);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy