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

autofixture.generators.enums.EnumSequenceGenerator Maven / Gradle / Ivy

There is a newer version: 2.1.10
Show newest version
package autofixture.generators.enums;

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

public class EnumSequenceGenerator implements InstanceGenerator {

  private final EnumCache enumCache;

  public EnumSequenceGenerator(final EnumCache enumCache) {
    this.enumCache = enumCache;
  }

  @Override
  public  boolean appliesTo(final InstanceType typeToken) {
    return typeToken.isEnum();
  }

  @Override
  public  T next(final InstanceType type, final FixtureContract fixture) {
    enumCache.registerIfNotPresent(type);
    return enumCache.retrieveNextValueOf(type);
  }

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy