net.jqwik.api.arbitraries.SizableArbitrary Maven / Gradle / Ivy
The newest version!
package net.jqwik.api.arbitraries;
import org.apiguardian.api.*;
import net.jqwik.api.*;
import org.jspecify.annotations.*;
import static org.apiguardian.api.API.Status.*;
/**
* Fluent interface to configure arbitraries that have size constraints for generated values, e.g. collections and arrays.
*/
@API(status = MAINTAINED, since = "1.0")
public interface SizableArbitrary extends Arbitrary {
/**
* Fix the size to {@code size}.
*/
default SizableArbitrary ofSize(int size) {
return ofMinSize(size).ofMaxSize(size);
}
/**
* Set lower size boundary {@code minSize} (included).
*/
SizableArbitrary ofMinSize(int minSize);
/**
* Set upper size boundary {@code maxSize} (included).
*/
SizableArbitrary ofMaxSize(int maxSize);
/**
* Set distribution {@code distribution} of size of generated arbitrary
*/
@API(status = EXPERIMENTAL, since = "1.5.3")
SizableArbitrary withSizeDistribution(RandomDistribution distribution);
}