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

autofixture.generators.time.InstantGenerator Maven / Gradle / Ivy

package autofixture.generators.time;

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

import java.time.Duration;
import java.time.Instant;

/**
 * Created by astral on 08.02.15.
 */
public class InstantGenerator implements InstanceGenerator {
  @Override
  public  boolean appliesTo(final InstanceType instanceType) {
    return instanceType.isRawTypeAssignableFrom(Instant.class);
  }

  @Override
  public  T next(final InstanceType instanceType, final FixtureContract fixture) {
    return (T) Instant.now().plus(Duration.ofMillis(fixture.create(Long.class)));
  }

  @Override
  public void setOmittingAutoProperties(final boolean isOn) {

  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy