Package com.github.nylle.javafixture
Class Configuration
- java.lang.Object
-
- com.github.nylle.javafixture.Configuration
-
public class Configuration extends Object
-
-
Constructor Summary
Constructors Constructor Description Configuration()Creates a new default configuration with the following valuesConfiguration(int maxCollectionSize, int minCollectionSize, int streamSize)Creates a new configuration with the specified valuesConfiguration(int maxCollectionSize, int minCollectionSize, int streamSize, boolean usePositiveNumbersOnly)Creates a new configuration with the specified values
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Configurationclock(Clock clock)ConfigurationcollectionSizeRange(int min, int max)Sets the minimum and maximum length for arrays, collections and mapsstatic Configurationconfigure()Creates a new default configuration with the following valuesFixturefixture()Returns a new fixture with this configurationClockgetClock()intgetMaxCollectionSize()intgetMinCollectionSize()intgetRandomCollectionSize()intgetStreamSize()ConfigurationstreamSize(int streamSize)booleanusePositiveNumbersOnly()ConfigurationusePositiveNumbersOnly(boolean usePositiveNumbersOnly)
-
-
-
Constructor Detail
-
Configuration
public Configuration()
Creates a new default configuration with the following values- maxCollectionSize = 10
- minCollectionSize = 2
- streamSize = 3
- usePositiveNumbersOnly = false
- clock = Clock.fixed(Instant.now(), ZoneOffset.UTC)
-
Configuration
public Configuration(int maxCollectionSize, int minCollectionSize, int streamSize)Creates a new configuration with the specified values- Parameters:
maxCollectionSize- the maximum size of arrays, collections and mapsminCollectionSize- the minimum size of arrays, collections and mapsstreamSize- the exact size of the result stream when creating many objects at once
-
Configuration
public Configuration(int maxCollectionSize, int minCollectionSize, int streamSize, boolean usePositiveNumbersOnly)Creates a new configuration with the specified values- Parameters:
maxCollectionSize- the maximum size of arrays, collections and mapsminCollectionSize- the minimum size of arrays, collections and mapsstreamSize- the exact size of the result stream when creating many objects at onceusePositiveNumbersOnly- whether to generate only positive numbers including 0
-
-
Method Detail
-
configure
public static Configuration configure()
Creates a new default configuration with the following values- maxCollectionSize = 10
- minCollectionSize = 2
- streamSize = 3
- usePositiveNumbersOnly = false
- clock = Clock.fixed(Instant.now(), ZoneOffset.UTC)
-
getMaxCollectionSize
public int getMaxCollectionSize()
- Returns:
- the maximum size of arrays, collections and maps
-
getMinCollectionSize
public int getMinCollectionSize()
- Returns:
- the minimum size of arrays, collections and maps
-
getStreamSize
public int getStreamSize()
- Returns:
- the stream size when creating many objects at once
-
getClock
public Clock getClock()
- Returns:
- the clock used when creating time-based objects
-
getRandomCollectionSize
public int getRandomCollectionSize()
- Returns:
- a random value between minimum and maximum size of arrays, collections and maps
-
usePositiveNumbersOnly
public boolean usePositiveNumbersOnly()
- Returns:
- whether to generate only positive numbers including 0
-
streamSize
public Configuration streamSize(int streamSize)
- Parameters:
streamSize- the stream size when creating many objects at once- Returns:
- this
Configuration
-
collectionSizeRange
public Configuration collectionSizeRange(int min, int max)
Sets the minimum and maximum length for arrays, collections and maps- Parameters:
min- the minimum size of arrays, collections and mapsmax- the maximum size of arrays, collections and maps- Returns:
- this
Configuration
-
clock
public Configuration clock(Clock clock)
- Parameters:
clock- the clock to use when generating time-based objects- Returns:
- this
Configuration
-
usePositiveNumbersOnly
public Configuration usePositiveNumbersOnly(boolean usePositiveNumbersOnly)
- Parameters:
usePositiveNumbersOnly- whether to generate only positive numbers including 0- Returns:
- this
Configuration
-
fixture
public Fixture fixture()
Returns a new fixture with this configuration- Returns:
Fixture
-
-