Class Configuration


  • public class Configuration
    extends Object
    • 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 maps
        minCollectionSize - the minimum size of arrays, collections and maps
        streamSize - 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 maps
        minCollectionSize - the minimum size of arrays, collections and maps
        streamSize - the exact size of the result stream when creating many objects at once
        usePositiveNumbersOnly - 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 maps
        max - 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