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

net.jqwik.engine.properties.shrinking.Unshrinkable Maven / Gradle / Ivy

The newest version!
package net.jqwik.engine.properties.shrinking;

import java.util.*;
import java.util.function.*;
import java.util.stream.*;

import net.jqwik.api.*;
import net.jqwik.engine.support.*;

import org.jspecify.annotations.*;

public class Unshrinkable implements Shrinkable {
	private final ShrinkingDistance distance;
	private final Supplier valueSupplier;

	public Unshrinkable(Supplier valueSupplier, ShrinkingDistance distance) {
		this.valueSupplier = valueSupplier;
		this.distance = distance;
	}

	@Override
	public T value() {
		return valueSupplier.get();
	}

	@Override
	public Stream> shrink() {
		return Stream.empty();
	}

	@Override
	public ShrinkingDistance distance() {
		return distance;
	}

	@Override
	public String toString() {
		return JqwikStringSupport.displayString(value());
	}

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

		Unshrinkable that = (Unshrinkable) o;

		return Objects.equals(value(), that.value());
	}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy