autofixture.generators.time.ClockGenerator Maven / Gradle / Ivy
The newest version!
package autofixture.generators.time;
import autofixture.interfaces.FixtureContract;
import autofixture.interfaces.InstanceGenerator;
import autofixture.interfaces.InstanceType;
import java.time.Clock;
import java.time.Instant;
import java.time.ZoneId;
/**
* Created by astral on 08.02.15.
*/
public class ClockGenerator implements InstanceGenerator {
@Override
public boolean appliesTo(final InstanceType instanceType) {
return instanceType.isRawTypeAssignableFrom(Clock.class);
}
@Override
public T next(final InstanceType instanceType, final FixtureContract fixture) {
return (T) Clock.fixed(fixture.create(Instant.class), fixture.create(ZoneId.class));
}
@Override
public T nextEmpty(final InstanceType instanceType, final FixtureContract fixture) {
return next(instanceType, fixture);
}
@Override
public void setOmittingAutoProperties(final boolean isOn) {
}
}