![JAR search and dependency download from the Maven repository](/logo.png)
autofixture.publicinterface.inline.GenerationConstrainedByValueRejection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of autofixturegenerator Show documentation
Show all versions of autofixturegenerator Show documentation
An attempt to reimplement core features of a popular .NET anonymous value generator - AutoFixture - in
Java
package autofixture.publicinterface.inline;
import autofixture.interfaces.FixtureContract;
import autofixture.interfaces.InlineConstrainedGenerator;
import autofixture.publicinterface.constraints.GenerationConstraint;
import com.google.common.reflect.TypeToken;
public class GenerationConstrainedByValueRejection implements InlineConstrainedGenerator {
private final GenerationConstraint constraint;
public GenerationConstrainedByValueRejection(final GenerationConstraint constraint) {
this.constraint = constraint;
}
@Override
public T next(final TypeToken typeToken, final FixtureContract fixture) {
T currentValue;
do {
currentValue = fixture.create(typeToken);
} while (constraint.doesNotAccept(currentValue));
return currentValue;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy