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

net.jqwik.engine.properties.stateful.ShrinkablesActionGenerator Maven / Gradle / Ivy

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

import java.util.*;

import net.jqwik.api.*;
import net.jqwik.api.stateful.*;

import org.jspecify.annotations.*;

class ShrinkablesActionGenerator implements ActionGenerator {

	private Iterator>> iterator;
	private List>> shrinkables = new ArrayList<>();

	ShrinkablesActionGenerator(List>> shrinkables) {
		iterator = shrinkables.iterator();
	}

	@Override
	public Action next(T model) {
		while (iterator.hasNext()) {
			Shrinkable> next = iterator.next();
			if (!next.value().precondition(model)) {
				continue;
			}
			shrinkables.add(next);
			return next.value();
		}
		throw new NoSuchElementException("No more actions available");
	}

	@Override
	public List>> generated() {
		return shrinkables;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy