All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.jqwik.engine.properties.arbitraries.FromGeneratorWithSizeArbitrary Maven / Gradle / Ivy

The newest version!
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> supplier;

	public FromGeneratorWithSizeArbitrary(IntFunction> 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();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy