autofixture.generators.vavr.VavrOptionGenerator Maven / Gradle / Ivy
package autofixture.generators.vavr;
import autofixture.interfaces.FixtureContract;
import autofixture.interfaces.InstanceGenerator;
import autofixture.interfaces.InstanceType;
import io.vavr.control.Option;
public class VavrOptionGenerator implements InstanceGenerator {
@Override
public boolean appliesTo(final InstanceType instanceType) {
return instanceType.isRawTypeAssignableFrom(Option.Some.class);
}
@Override
public T next(final InstanceType instanceType, final FixtureContract fixture) {
return (T) Option.some(fixture.create(instanceType.getNestedGenericType1()));
}
@Override
public T nextEmpty(final InstanceType instanceType, final FixtureContract fixture) {
return (T)Option.none();
}
@Override
public void setOmittingAutoProperties(final boolean isOn) {
}
}