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

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

There is a newer version: 1.9.1
Show newest version
package net.jqwik.engine.properties.arbitraries;

import java.util.*;

import net.jqwik.engine.properties.arbitraries.exhaustive.*;
import net.jqwik.engine.properties.arbitraries.randomized.*;

import org.jspecify.annotations.*;

public class ChooseValueArbitrary extends UseGeneratorsArbitrary {

	private final int hashCode;
	private final List values;

	public ChooseValueArbitrary(List values) {
		super(
			RandomGenerators.choose(values),
			max -> ExhaustiveGenerators.choose(values, max),
			maxEdgeCases -> EdgeCasesSupport.choose(values, maxEdgeCases)
		);
		hashCode = values.hashCode();
		this.values = values;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		ChooseValueArbitrary that = (ChooseValueArbitrary) o;
		return values.equals(that.values);
	}

	@Override
	public int hashCode() {
		return hashCode;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy