net.jqwik.engine.properties.arbitraries.FromGeneratorWithSizeArbitrary Maven / Gradle / Ivy
package net.jqwik.engine.properties.arbitraries;
import java.util.function.*;
import net.jqwik.api.*;
import net.jqwik.api.support.*;
import org.jspecify.annotations.*;
public class FromGeneratorWithSizeArbitrary implements Arbitrary {
private final IntFunction extends RandomGenerator> supplier;
public FromGeneratorWithSizeArbitrary(IntFunction extends RandomGenerator> generatorSupplier) {
this.supplier = generatorSupplier;
}
@Override
public RandomGenerator generator(final int genSize) {
return supplier.apply(genSize);
}
@Override
public EdgeCases edgeCases(int maxEdgeCases) {
return EdgeCases.none();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
FromGeneratorWithSizeArbitrary> that = (FromGeneratorWithSizeArbitrary>) o;
return LambdaSupport.areEqual(supplier, that.supplier);
}
@Override
public int hashCode() {
return supplier.getClass().hashCode();
}
}