net.jqwik.engine.properties.shrinking.ShrinkableSet Maven / Gradle / Ivy
package net.jqwik.engine.properties.shrinking;
import java.util.*;
import java.util.stream.*;
import net.jqwik.api.*;
public class ShrinkableSet extends ShrinkableContainer, E> {
private final int minSize;
public ShrinkableSet(Set> elements, int minSize) {
this(new ArrayList<>(elements), minSize);
}
private ShrinkableSet(List> elements, int minSize) {
super(elements, minSize);
this.minSize = minSize;
}
@Override
public ShrinkingSequence> shrink(Falsifier> falsifier) {
return super.shrink(falsifier.withFilter(set -> set.size() >= minSize));
}
@Override
Collector> containerCollector() {
return Collectors.toSet();
}
@Override
Shrinkable> createShrinkable(List> shrunkElements) {
return new ShrinkableSet<>(shrunkElements, minSize);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy