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

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

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

import org.jspecify.annotations.*;

public class ShuffleArbitrary extends UseGeneratorsArbitrary> {
	private final List values;

	public ShuffleArbitrary(List values) {
		super(
			RandomGenerators.shuffle(values),
			max -> ExhaustiveGenerators.shuffle(values, max),
			maxEdgeCases -> EdgeCases.fromSupplier(() -> Shrinkable.unshrinkable(values))
		);
		this.values = values;
	}

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy