autofixture.generators.BooleanGenerator Maven / Gradle / Ivy
package autofixture.generators;
import autofixture.interfaces.FixtureContract;
import autofixture.interfaces.InstanceGenerator;
import autofixture.interfaces.InstanceType;
public class BooleanGenerator implements InstanceGenerator {
private Boolean currentValue = false;
@Override
public boolean appliesTo(final InstanceType typeToken) {
return typeToken.isCompatibleWith(Boolean.class);
}
@SuppressWarnings("unchecked")
@Override
public T next(final InstanceType typeToken, final FixtureContract fixture) {
currentValue = !currentValue;
return (T) currentValue;
}
@Override
public T nextEmpty(final InstanceType instanceType, final FixtureContract fixture) {
return next(instanceType, fixture);
}
@Override
public void setOmittingAutoProperties(final boolean isOn) {
}
}