autofixture.generators.time.ChronoLocalDateGenerator Maven / Gradle / Ivy
package autofixture.generators.time;
import autofixture.interfaces.FixtureContract;
import autofixture.interfaces.InstanceGenerator;
import autofixture.interfaces.InstanceType;
import java.time.LocalDate;
import java.time.Period;
import java.time.chrono.ChronoLocalDate;
/**
* Created by astral on 08.02.15.
*/
public class ChronoLocalDateGenerator implements InstanceGenerator {
@Override
public boolean appliesTo(final InstanceType instanceType) {
return instanceType.isRawTypeAssignableFrom(ChronoLocalDate.class);
}
@Override
public T next(final InstanceType instanceType, final FixtureContract fixture) {
return (T) LocalDate.now().plus(Period.ofWeeks(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) {
}
}