Arbitrary.ArbitraryFacade
Modifier and Type | Method and Description |
---|---|
StringArbitrary |
all()
Allow all unicode chars even noncharacters and private use characters
but only in plane 0 (aka Basic Multilingual Plane)
|
StringArbitrary |
alpha()
Allow all alpha chars to show up in generated strings.
|
StringArbitrary |
ascii()
Allow all ascii chars to show up in generated strings.
|
StringArbitrary |
excludeChars(char... charsToExclude)
Exclude all
charsToExclude from generated strings |
StringArbitrary |
numeric()
Allow all numeric chars (digits) to show up in generated strings.
|
default StringArbitrary |
ofLength(int length)
Fix the length to
length of generated strings. |
StringArbitrary |
ofMaxLength(int maxLength)
Set the maximum allowed length
maxLength (included) of generated strings. |
StringArbitrary |
ofMinLength(int minLength)
Set the minimum allowed length
minLength (included) of generated strings. |
StringArbitrary |
repeatChars(double repeatProbability)
Set the probability for repeating chars within the string to an approximate probability value.
|
StringArbitrary |
uniqueChars()
Prevent character from having duplicates within the generated string.
|
StringArbitrary |
whitespace()
Allow all chars that will return
true for
Character.isWhitespace(char) . |
StringArbitrary |
withCharRange(char from,
char to)
Allow all chars within
from (included) and to (included) to show up in generated strings. |
StringArbitrary |
withChars(char... chars)
Allow all chars in
chars to show up in generated strings. |
StringArbitrary |
withChars(java.lang.CharSequence chars)
Allow all chars in
chars to show up in generated strings. |
StringArbitrary |
withLengthDistribution(RandomDistribution lengthDistribution)
Set random distribution
distribution of length of generated string. |
allValues, array, asGeneric, collect, dontShrink, edgeCases, edgeCases, edgeCases, exhaustive, exhaustive, filter, filter, fixGenSize, flatMap, forEachValue, generator, generator, generatorWithEmbeddedEdgeCases, ignoreException, ignoreException, ignoreExceptions, ignoreExceptions, injectDuplicates, injectNull, isGeneratorMemoizable, iterator, list, map, optional, optional, sample, sampleStream, set, stream, tuple1, tuple2, tuple3, tuple4, tuple5, withoutEdgeCases
StringArbitrary ofMaxLength(int maxLength)
maxLength
(included) of generated strings.java.lang.IllegalArgumentException
- if maxLength < 0 or maxLength < min lengthStringArbitrary ofMinLength(int minLength)
minLength
(included) of generated strings.
This will also set the max length of the string if minLength
is larger than the current max length.java.lang.IllegalArgumentException
- if minLength < 0default StringArbitrary ofLength(int length)
length
of generated strings.java.lang.IllegalArgumentException
- if length < 0StringArbitrary withChars(char... chars)
chars
to show up in generated strings.
Can be combined with other methods that allow chars.@API(status=MAINTAINED, since="1.2.1") StringArbitrary withChars(java.lang.CharSequence chars)
chars
to show up in generated strings.
Can be combined with other methods that allow chars.StringArbitrary withCharRange(char from, char to)
from
(included) and to
(included) to show up in generated strings.
Can be combined with other methods that allow chars.StringArbitrary ascii()
StringArbitrary alpha()
StringArbitrary numeric()
StringArbitrary whitespace()
true
for
Character.isWhitespace(char)
.
Can be combined with other methods that allow chars.StringArbitrary all()
@API(status=MAINTAINED, since="1.5.1") StringArbitrary excludeChars(char... charsToExclude)
charsToExclude
from generated stringscharsToExclude
- chars to exclude@API(status=EXPERIMENTAL, since="1.5.3") StringArbitrary withLengthDistribution(RandomDistribution lengthDistribution)
distribution
of length of generated string.
The distribution's center is the minimum length of the generated list.@API(status=MAINTAINED, since="1.5.3") StringArbitrary repeatChars(double repeatProbability)
Setting @code{repeatProbability} to 0.0 will generate strings with unique chars, i.e.,
it is equivalent to calling uniqueChars()
.
repeatProbability
- Must be between 0 (included) and 1 (excluded)@API(status=EXPERIMENTAL, since="1.8.0") StringArbitrary uniqueChars()