autofixture.generators.numbers.BigDecimalGenerator Maven / Gradle / Ivy
The newest version!
package autofixture.generators.numbers;
import autofixture.interfaces.FixtureContract;
import autofixture.interfaces.InstanceGenerator;
import autofixture.interfaces.InstanceType;
import java.math.BigDecimal;
public class BigDecimalGenerator implements InstanceGenerator {
@Override
public boolean appliesTo(final InstanceType typeToken) {
return typeToken.isAssignableFrom(BigDecimal.class);
}
@SuppressWarnings("unchecked")
@Override
public T next(final InstanceType typeToken, final FixtureContract fixture) {
return (T) new BigDecimal(fixture.create(Integer.class));
}
@Override
public T nextEmpty(final InstanceType instanceType, final FixtureContract fixture) {
return next(instanceType, fixture);
}
@Override
public void setOmittingAutoProperties(final boolean isOn) {
}
}