Additional top-level class in compilation unit: GenModule.
To ease the creation of Arbitraries, Gen is a FunctionalInterface which extends Function<Random, T>.
Gen objects are obtained via one of the methods choose, fail, frequency, of and
oneOf.
Given Gen objects may be transformed using one of the methods filter, map and flatMap.
A simple way to obtain an Arbitrary of a Gen is to call Gen#arbitrary(). This will ignore the size hint of Arbitrary.
Arbitrary
| Modifier and Type | Method and Description |
|---|---|
| public T | |
| public default Arbitrary | Returns: An arbitrary which returns this generator regardless of the provided size hint nConverts this Gen to an Arbitrary |
| public static Gen | Returns: A new int generatorlower bound min, int upper bound max)Chooses an int between min and max, bounds inclusive and numbers distributed according to the distribution of the underlying random number generator. |
| public static Gen | Returns: A new long generatorlower bound min, long upper bound max)Chooses a long between min and max, bounds inclusive and numbers distributed according to the distribution of the underlying random number generator. |
| public static Gen | Returns: A new double generatorlower bound min, double upper bound max)Chooses a double between min and max, bounds inclusive and numbers distributed according to the distribution of the underlying random number generator. |
| public static Gen | Returns: A new char generatorlower bound min, char upper bound max)Chooses a char between min and max, bounds inclusive and chars distributed according to the underlying random number generator. |
| public static Gen | Returns: A new array generatorarray with the characters to choose from characters)Chooses a char from all chars in the array |
| public static < type of enum constants T extends Enum | |
| public static < value type T> Gen | Returns: A new array generatorarray with the values to choose from values)Chooses a value from all values in the array. |
| public static < value type T> Gen | |
| public static < Type of values theoretically generated. T> Gen | Returns: A new generator which always fails with the message "failed"A failing generator which throws a RuntimeException("failed"). |
| public static < Type of values theoretically generated. T> Gen | |
| public default Gen | |
| public default < Type of generated objects of the new generator U> Gen | |
| public static < Type to be generated T> Gen | |
| public static < Type to be generated T> Gen | |
| public default Gen | Returns: A new T generatoranother T generator to accept values from. other)Intersperse values from this generator instance with those of another. |
| public default < Type of the mapped object U> Gen | |
| public static < Type of t. T> Gen | |
| public static <T> Gen | |
| public static < Type to be generated T> Gen | |
| public static < Type to be generated T> Gen | |
| public default Gen | |
| public default < Type of transformation result U> U |
| apply | back to summary |
|---|---|
| public T apply(Random random) Functional interface of this generator.
| |
| arbitrary | back to summary |
|---|---|
| public default Arbitrary Converts this Gen to an Arbitrary
| |
| choose | back to summary |
|---|---|
| public static Gen Chooses an int between min and max, bounds inclusive and numbers distributed according to the distribution of the underlying random number generator. Note min and max are internally swapped if min > max. | |
| choose | back to summary |
|---|---|
| public static Gen Chooses a long between min and max, bounds inclusive and numbers distributed according to the distribution of the underlying random number generator. Note min and max are internally swapped if min > max. | |
| choose | back to summary |
|---|---|
| public static Gen Chooses a double between min and max, bounds inclusive and numbers distributed according to the distribution of the underlying random number generator. Note min and max are internally swapped if min > max.
| |
| choose | back to summary |
|---|---|
| public static Gen Chooses a char between min and max, bounds inclusive and chars distributed according to the underlying random number generator. Note min and max are internally swapped if min > max. | |
| choose | back to summary |
|---|---|
| public static Gen Chooses a char from all chars in the array | |
| choose | back to summary |
|---|---|
| public static <T extends Enum Chooses an enum value from all the enum constants defined in the enumerated type. | |
| choose | back to summary |
|---|---|
| public static <T> Gen Chooses a value from all values in the array.
| |
| choose | back to summary |
|---|---|
| public static <T> Gen Chooses a value from all values in the iterable | |
| fail | back to summary |
|---|---|
| public static <T> Gen A failing generator which throws a RuntimeException("failed").
| |
| fail | back to summary |
|---|---|
| public static <T> Gen A failing generator which throws a RuntimeException. | |
| filter | back to summary |
|---|---|
| public default Gen Returns a generator based on this generator which produces values that fulfill the given predicate. | |
| flatMap | back to summary |
|---|---|
| public default <U> Gen Maps generated Ts to Us. | |
| frequency | back to summary |
|---|---|
| public static <T> Gen Chooses one of the given generators according to their frequency. Only generators with positive frequencies are used in returned generator.
| |
| frequency | back to summary |
|---|---|
| public static <T> Gen Chooses one of the given generators according to their frequency. Only generators with positive frequencies ares used in returned generator.
| |
| intersperse | back to summary |
|---|---|
| public default Gen Intersperse values from this generator instance with those of another. | |
| map | back to summary |
|---|---|
| public default <U> Gen Maps generated Ts to Us. | |
| of | back to summary |
|---|---|
| public static <T> Gen A generator which constantly returns t.
| |
| of | back to summary |
|---|---|
| public static <T> Gen | |
| oneOf | back to summary |
|---|---|
| public static <T> Gen Randomly chooses one of the given generators.
| |
| oneOf | back to summary |
|---|---|
| public static <T> Gen Randomly chooses one of the given generators.
| |
| peek | back to summary |
|---|---|
| public default Gen | |
| transform | back to summary |
|---|---|
| public default <U> U transform(Function<? super Gen<T>, ? extends U> f) Transforms this
| |