Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
autofixture.generators.DefaultGeneratorsFactory Maven / Gradle / Ivy
package autofixture.generators;
import autofixture.generators.collections.*;
import autofixture.generators.enums.EnumSequenceGenerator;
import autofixture.generators.enums.InMemoryEnumCache;
import autofixture.generators.numbers.*;
import autofixture.generators.objects.ConcreteObjectGenerator;
import autofixture.generators.objects.InterfaceImplementationGenerator;
import autofixture.generators.objects.ObjenesisGenerator;
import autofixture.generators.objects.PlainObjectGenerator;
import autofixture.generators.throwables.ErrorGenerator;
import autofixture.generators.throwables.ExceptionGenerator;
import autofixture.generators.throwables.ThrowableGenerator;
import autofixture.generators.time.*;
import autofixture.interfaces.GeneratorsPipeline;
import autofixture.interfaces.InstanceGenerator;
import autofixture.interfaces.RecursionGuard;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class DefaultGeneratorsFactory {
public GeneratorsPipeline createBuiltinGenerators(final RecursionGuard recursionGuard) {
return
protectedBy(recursionGuard,
pipelineOfGeneratorsForTypes(
matchedInTheFollowingOrder(
integers(),
enums(),
throwables(),
exceptions(),
errors(),
strings(),
doubles(),
floats(),
bigIntegers(),
bigDecimals(),
dates(),
calendars(),
chronoLocalDates(),
chronoLocalDateTimes(),
localDateTimes(),
localDates(),
zonedDateTimes(),
zoneIds(),
offsetTimes(),
periods(),
durations(),
zoneOffsets(),
clocks(),
instants(),
objects(),
booleans(),
urls(),
arrays(),
optionals(),
builtInCollections(),
builtInMaps(),
inetAddresses(),
interfaceImplementations(),
colorSpaces(),
concreteObjects()))
);
}
private InstanceGenerator throwables() {
return new ThrowableGenerator();
}
public DefaultGeneratorsPipeline createDummyGenerators() {
return pipelineOfGeneratorsForTypes(
matchedInTheFollowingOrder(
integers(),
enums(),
exceptions(),
errors(),
strings(),
doubles(),
floats(),
bigIntegers(),
bigDecimals(),
dates(),
calendars(),
chronoLocalDates(),
chronoLocalDateTimes(),
localDateTimes(),
localDates(),
zonedDateTimes(),
zoneIds(),
offsetTimes(),
periods(),
durations(),
zoneOffsets(),
clocks(),
instants(),
objects(),
booleans(),
urls(),
emptyArrays(),
optionals(),
emptyCollections(),
emptyMaps(),
inetAddresses(),
interfaceImplementations(),
colorSpaces(),
emptyObjects()));
}
private InstanceGenerator emptyMaps() {
return new EmptyMapGenerator();
}
private InstanceGenerator builtInMaps() {
return new BuiltInMapGenerator();
}
private ObjenesisGenerator emptyObjects() {
return new ObjenesisGenerator();
}
private EmptyArraysGenerator emptyArrays() {
return new EmptyArraysGenerator();
}
private EmptyCollectionsGenerator emptyCollections() {
return new EmptyCollectionsGenerator();
}
private InstanceGenerator instants() {
return new InstantGenerator();
}
private InstanceGenerator clocks() {
return clockGenerator();
}
private InstanceGenerator clockGenerator() {
return new ClockGenerator();
}
private InstanceGenerator zoneOffsets() {
return new ZoneOffsetGenerator();
}
private InstanceGenerator chronoLocalDateTimes() {
return new ChronoLocalDateTimeGenerator();
}
private InstanceGenerator chronoLocalDates() {
return new ChronoLocalDateGenerator();
}
private InstanceGenerator durations() {
return new DurationGenerator();
}
private InstanceGenerator periods() {
return new PeriodGenerator();
}
private InstanceGenerator offsetTimes() {
return new OffsetTimeGenerator();
}
private InstanceGenerator zoneIds() {
return new ZoneIdGenerator();
}
private InstanceGenerator zonedDateTimes() {
return new ZonedDateTimeGenerator();
}
private InstanceGenerator localDates() {
return new LocalDateGenerator();
}
private InstanceGenerator localDateTimes() {
return new LocalDateTimeGenerator();
}
/*
@DataPoint public static InstanceOf localDateTime = new InstanceOf() { };
@DataPoint public static InstanceOf localDate = new InstanceOf() { };
@DataPoint public static InstanceOf month = new InstanceOf() { };
@DataPoint public static InstanceOf zonedDateTime = new InstanceOf() { };
@DataPoint public static InstanceOf zoneId = new InstanceOf() { };
@DataPoint public static InstanceOf offsetTime = new InstanceOf() { };
@DataPoint public static InstanceOf period = new InstanceOf() { };
@DataPoint public static InstanceOf duration = new InstanceOf() { };
@DataPoint public static InstanceOf chronology = new InstanceOf() { };
@DataPoint public static InstanceOf chronoLocalDate = new InstanceOf() { };
@DataPoint public static InstanceOf chronoLocalDateTime = new InstanceOf() { };
@DataPoint public static InstanceOf chronoZonedDateTime = new InstanceOf() { };
@DataPoint public static InstanceOf zoneOffset = new InstanceOf() { };
*/
private InstanceGenerator colorSpaces() {
return new ColorSpaceGenerator();
}
private InstanceGenerator optionals() {
return new OptionalsGenerator();
}
private DefaultGeneratorsPipeline pipelineOfGeneratorsForTypes(final List generators) {
return new DefaultGeneratorsPipeline(generators);
}
private java.util.List matchedInTheFollowingOrder(final InstanceGenerator... ts) {
return new LinkedList<>(Arrays.asList(ts));
}
private RandomNumberGenerator integers() {
return new RandomNumberGenerator();
}
private GeneratorsPipeline protectedBy(
final RecursionGuard recursionGuard, final DefaultGeneratorsPipeline defaultGeneratorsPipeline) {
return new RecursionGuarded(defaultGeneratorsPipeline, recursionGuard);
}
private ConcreteObjectGenerator concreteObjects() {
return new ConcreteObjectGenerator();
}
private InterfaceImplementationGenerator interfaceImplementations() {
return new InterfaceImplementationGenerator();
}
private InetAddressGenerator inetAddresses() {
return new InetAddressGenerator();
}
private BuiltInCollectionGenerator builtInCollections() {
return new BuiltInCollectionGenerator();
}
private ArrayGenerator arrays() {
return new ArrayGenerator();
}
private UrlGenerator urls() {
return new UrlGenerator();
}
private BooleanGenerator booleans() {
return new BooleanGenerator();
}
private ByteAndCharSequenceGenerator bytesAndChars() {
return new ByteAndCharSequenceGenerator();
}
private PlainObjectGenerator objects() {
return new PlainObjectGenerator();
}
private CalendarGenerator calendars() {
return new CalendarGenerator();
}
private DateGenerator dates() {
return new DateGenerator();
}
private BigDecimalGenerator bigDecimals() {
return new BigDecimalGenerator();
}
private BigIntGenerator bigIntegers() {
return new BigIntGenerator();
}
private DoubleSequenceGenerator doubles() {
return new DoubleSequenceGenerator();
}
private FloatSequenceGenerator floats() {
return new FloatSequenceGenerator();
}
private StringGenerator strings() {
return new StringGenerator();
}
private ErrorGenerator errors() {
return new ErrorGenerator();
}
private ExceptionGenerator exceptions() {
return new ExceptionGenerator();
}
private EnumSequenceGenerator enums() {
return new EnumSequenceGenerator(new InMemoryEnumCache());
}
}