All Downloads are FREE. Search and download functionalities are using the official Maven repository.

autofixture.generators.numbers.DoubleSequenceGenerator Maven / Gradle / Ivy

package autofixture.generators.numbers;

import autofixture.interfaces.FixtureContract;
import autofixture.interfaces.InstanceGenerator;
import autofixture.interfaces.InstanceType;

public class DoubleSequenceGenerator implements InstanceGenerator {
  private static final Double ARBITRARY_DOUBLE = 0.3;
  private Double startingNumber = ARBITRARY_DOUBLE;

  @Override
  public  boolean appliesTo(final InstanceType typeToken) {
    return typeToken.isCompatibleWithAnyOf(Double.class);
  }

  @SuppressWarnings("unchecked")
  @Override
  public  T next(final InstanceType typeToken, final FixtureContract fixture) {
    return (T) (startingNumber++);
  }

  @Override
  public  T nextEmpty(final InstanceType instanceType, final FixtureContract fixture) {
    return next(instanceType, fixture);
  }

  @Override
  public void setOmittingAutoProperties(final boolean isOn) {
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy