|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.java.quickcheck.generator.PrimitiveGenerators
@Samples @Iterables public class PrimitiveGenerators
PrimitiveGenerators
contains factory methods for primitive value
generators. These can be used to build custom test case generators.
The default distribution for generators is Distribution.UNIFORM
.
Field Summary | |
---|---|
static int |
DEFAULT_STRING_MAX_LENGTH
|
Constructor Summary | |
---|---|
PrimitiveGenerators()
|
Method Summary | ||
---|---|---|
static Generator<Character> |
basicLatinCharacters()
Create a new character generator which generates latin characters. |
|
static Generator<Boolean> |
booleans()
Create a generator for boolean values. |
|
static Generator<Byte> |
bytes()
Create a new byte generator which creates byte values ranging from Byte.MIN_VALUE to Byte.MAX_VALUE . |
|
static Generator<Byte> |
bytes(byte lo,
byte hi)
Create a new byte generator which creates byte values ranging from lo to hi. |
|
static Generator<Byte> |
bytes(byte lo,
byte hi,
Distribution distribution)
Create a new integer generator which creates integers ranging from lo to hi based on the given Distribution . |
|
static Generator<Character> |
characters()
Create a new character generator. |
|
static Generator<Character> |
characters(Character... chars)
Create a new character generator which generates characters from the given character array. |
|
static Generator<Character> |
characters(char lo,
char hi)
Create a new character generator which generates characters ranging from lo to hi. |
|
static Generator<Character> |
characters(Collection<Character> chars)
Create a new character generator which generates characters from the given character collection. |
|
static Generator<Character> |
characters(String string)
Create a new character generator which generates characters from the given string. |
|
static
|
clonedValues(T prototype)
A cloning generator which uses object serialization to create clones of the prototype object. |
|
static Generator<Date> |
dates()
Create a generator for date values. |
|
static Generator<Date> |
dates(Date low,
Date high)
Create a generator for date values from low to high. |
|
static Generator<Date> |
dates(long low,
long high)
Create a generator for date values from low to high. |
|
static Generator<Date> |
dates(Long low,
Long high,
TimeUnit precision)
Create a generator for date values from low to high with the given precision. |
|
static Generator<Date> |
dates(TimeUnit precision)
Create a generator for date values with the given precision. |
|
static
|
defaultObjects(Class<T> objectType)
Create a generator from a declarative object generator definition . |
|
static Generator<Double> |
doubles()
Create a new double generator which creates doubles ranging from Double.MIN_VALUE to Double.MAX_VALUE . |
|
static Generator<Double> |
doubles(double lo,
double hi)
Create a new double generator which creates doubles ranging from lo to hi. |
|
static Generator<Double> |
doubles(double lo,
double hi,
Distribution distribution)
Create a new double generator which creates doubles ranging from lo to hi based on the given Distribution . |
|
static
|
enumValues(Class<T> enumClass)
Create a generator of enumeration values. |
|
static
|
enumValues(Class<T> enumClass,
Collection<T> excludedCollection)
Create a generator of enumeration values. |
|
static
|
enumValues(Class<T> enumClass,
T... excluded)
Create a generator of enumeration values. |
|
static
|
fixedValues(Collection<T> values)
Create a fixed value generator returning one of the values from the values collection. |
|
static
|
fixedValues(T... values)
Create a fixed value generator returning one of the values from the values array. |
|
static
|
fixedValues(T value)
Create a generator for fixed value generator. |
|
static Generator<Integer> |
integers()
Create a new integer generator which creates integers ranging from Integer.MIN_VALUE to Integer.MAX_VALUE . |
|
static Generator<Integer> |
integers(int low)
Create a new integer generator which creates integers that are at equal or greater than low. |
|
static Generator<Integer> |
integers(int lo,
int hi)
Create a new integer generator which creates integers ranging from lo to hi. |
|
static Generator<Integer> |
integers(int lo,
int hi,
Distribution distribution)
Create a new integer generator which creates integers ranging from lo to hi based on the given Distribution . |
|
static Generator<Character> |
latin1SupplementCharacters()
Create a new character generator which generates latin-1 supplement characters. |
|
static ExtendibleGenerator<Character,String> |
letterStrings()
Create a new string generator which creates strings of characters from a-z and A-Z. |
|
static ExtendibleGenerator<Character,String> |
letterStrings(int min,
int max)
Create a new string generator which creates strings with sizes ranging from loLengh to hiLength of characters from a-z and A-Z. |
|
static Generator<Long> |
longs()
Create a new long generator which creates longs ranging from Long.MIN_VALUE to Long.MAX_VALUE . |
|
static Generator<Long> |
longs(long lo,
long hi)
Create a new long generator which creates longs ranging from lo to hi. |
|
static Generator<Long> |
longs(long lo,
long hi,
Distribution distribution)
Create a new long generator which creates longs ranging from lo to hi based on the given Distribution . |
|
static ExtendibleGenerator<Character,String> |
nonEmptyStrings()
Create a new string generator for strings that are not empty. |
|
static
|
nulls()
Create a generator for null values. |
|
static Generator<Object> |
objects()
Create a generator for java.lang.Object instances. |
|
static
|
objects(Class<T> objectType)
Create a generator from a declarative object generator definition . |
|
static Generator<Integer> |
positiveIntegers()
Create a new integer generator which creates positive integers. |
|
static Generator<Integer> |
positiveIntegers(int high)
Create a new integer generator which creates positive integers than are equal or smaller than high. |
|
static Generator<Long> |
positiveLongs()
Create a new long generator which creates long values ranging from 1 to Long.MAX_VALUE . |
|
static Generator<Long> |
positiveLongs(long hi)
Create a new long generator which creates long values ranging from 1 to hi. |
|
static ExtendibleGenerator<Character,String> |
printableStrings()
Create a new string generator which creates strings of characters generated by basicLatinCharacters() and
latin1SupplementCharacters() . |
|
static ExtendibleGenerator<Character,String> |
strings()
Create a new string generator. |
|
static ExtendibleGenerator<Character,String> |
strings(char lo,
char hi)
Create a new string generator which generates strings of characters ranging from lo to hi. |
|
static ExtendibleGenerator<Character,String> |
strings(Generator<Character> characterGenerator)
Create a new string generator which creates strings of characters generated by the given character generator. |
|
static ExtendibleGenerator<Character,String> |
strings(Generator<Integer> length,
Generator<Character> characters)
Create a new string generator which creates strings of characters generated by the given character generator with a length generated by the length generator. |
|
static ExtendibleGenerator<Character,String> |
strings(int max)
Creates a new String genearator which generates strings whose length ranges from zero to given length. |
|
static ExtendibleGenerator<Character,String> |
strings(int min,
int max)
Create a new string generator which generates strings of sizes ranging from loLength to hiLength. |
|
static ExtendibleGenerator<Character,String> |
strings(String allowedCharacters)
Create a new string generator which generates strings of characters from the given string. |
|
static ExtendibleGenerator<Character,String> |
strings(String allowedCharacters,
int min,
int max)
Create a new string generator which generates strings of characters from the given string with a length between min and max. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_STRING_MAX_LENGTH
Constructor Detail |
---|
public PrimitiveGenerators()
Method Detail |
---|
public static ExtendibleGenerator<Character,String> strings()
public static ExtendibleGenerator<Character,String> strings(char lo, char hi)
lo
- lower boundary characterhi
- upper boundary characterpublic static ExtendibleGenerator<Character,String> strings(String allowedCharacters)
public static ExtendibleGenerator<Character,String> strings(String allowedCharacters, int min, int max)
public static ExtendibleGenerator<Character,String> strings(int max)
public static ExtendibleGenerator<Character,String> strings(int min, int max)
min
- lower size boundarymax
- upper size boundarypublic static ExtendibleGenerator<Character,String> strings(Generator<Integer> length, Generator<Character> characters)
public static ExtendibleGenerator<Character,String> strings(Generator<Character> characterGenerator)
public static ExtendibleGenerator<Character,String> letterStrings()
public static ExtendibleGenerator<Character,String> letterStrings(int min, int max)
public static ExtendibleGenerator<Character,String> printableStrings()
basicLatinCharacters()
and
latin1SupplementCharacters()
.
public static ExtendibleGenerator<Character,String> nonEmptyStrings()
public static Generator<Character> characters(char lo, char hi)
public static Generator<Character> characters()
public static Generator<Character> characters(Character... chars)
public static Generator<Character> characters(String string)
public static Generator<Character> characters(Collection<Character> chars)
public static Generator<Character> latin1SupplementCharacters()
public static Generator<Character> basicLatinCharacters()
public static Generator<Integer> integers()
Integer.MIN_VALUE
to Integer.MAX_VALUE
.
public static Generator<Integer> integers(int low)
public static Generator<Integer> integers(int lo, int hi)
public static Generator<Integer> integers(int lo, int hi, Distribution distribution)
Distribution
.
public static Generator<Integer> positiveIntegers()
public static Generator<Integer> positiveIntegers(int high)
public static Generator<Byte> bytes()
Byte.MIN_VALUE
to Byte.MAX_VALUE
.
public static Generator<Byte> bytes(byte lo, byte hi)
public static Generator<Byte> bytes(byte lo, byte hi, Distribution distribution)
Distribution
.
public static Generator<Long> longs()
Long.MIN_VALUE
to Long.MAX_VALUE
.
public static Generator<Long> longs(long lo, long hi)
public static Generator<Long> longs(long lo, long hi, Distribution distribution)
Distribution
.
public static Generator<Long> positiveLongs()
Long.MAX_VALUE
.
public static Generator<Long> positiveLongs(long hi)
public static Generator<Double> doubles()
Double.MIN_VALUE
to Double.MAX_VALUE
.
public static Generator<Double> doubles(double lo, double hi)
public static Generator<Double> doubles(double lo, double hi, Distribution distribution)
Distribution
.
public static Generator<Boolean> booleans()
public static <T> Generator<T> nulls()
public static Generator<Date> dates()
public static Generator<Date> dates(TimeUnit precision)
public static Generator<Date> dates(Date low, Date high)
public static Generator<Date> dates(long low, long high)
public static Generator<Date> dates(Long low, Long high, TimeUnit precision)
public static <T> Generator<T> fixedValues(T value)
public static <T> Generator<T> fixedValues(T... values)
public static <T> Generator<T> fixedValues(Collection<T> values)
public static <T> Generator<T> clonedValues(T prototype)
public static <T extends Enum<T>> Generator<T> enumValues(Class<T> enumClass)
T
- Type of enumerationsenumClass
- class of enumeration
public static <T extends Enum<T>> Generator<T> enumValues(Class<T> enumClass, T... excluded)
T
- Type of enumerationsenumClass
- class of enumerationexcluded
- excluded values of enumeration
public static <T extends Enum<T>> Generator<T> enumValues(Class<T> enumClass, Collection<T> excludedCollection)
T
- Type of enumerationsenumClass
- class of enumerationexcludedCollection
- excluded values of enumeration
public static Generator<Object> objects()
java.lang.Object
instances.
Note: every invocation of Generator.next()
creates a new instance.
public static <T> ObjectGenerator<T> objects(Class<T> objectType)
declarative object generator definition
.
public static <T> ObjectGenerator<T> defaultObjects(Class<T> objectType)
declarative object generator definition
.undefined methods
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |