autofixture.generators.vavr.VavrNodeGenerator Maven / Gradle / Ivy
The newest version!
package autofixture.generators.vavr;
import autofixture.interfaces.FixtureContract;
import autofixture.interfaces.InstanceGenerator;
import autofixture.interfaces.InstanceType;
import io.vavr.collection.List;
import io.vavr.collection.Tree;
public class VavrNodeGenerator implements InstanceGenerator {
@Override
public boolean appliesTo(final InstanceType instanceType) {
return instanceType.isRawTypeAssignableFrom(Tree.Node.class);
}
@Override
public T next(final InstanceType instanceType, final FixtureContract fixture) {
return (T)new Tree.Node(
fixture.create(instanceType.getNestedGenericType1()),
List.empty()
);
}
@Override
public T nextEmpty(final InstanceType instanceType, final FixtureContract fixture) {
return (T) new Tree.Node(
fixture.createDummy(instanceType.getNestedGenericType1()),
List.empty()
);
}
@Override
public void setOmittingAutoProperties(final boolean isOn) {
}
}