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

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

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

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

import java.time.Period;
import java.time.ZonedDateTime;

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

  @Override
  public  T next(final InstanceType instanceType, final FixtureContract fixture) {
    return (T) ZonedDateTime.now().plus(Period.ofDays(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) {

  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy