Package jsonvalues.gen
Class JsStrGen
java.lang.Object
jsonvalues.gen.JsStrGen
Represents a JsStr generator. There are different static factory methods to create all kind of generators:
- One character generators like
alphanumeric
, digit
, letter
and alphabetic
.
- String generators like digits
, letters
, alphanumeric
, alphabetic
, arbitrary
and biased
.
The length of the generated strings is distributed uniformly over a specified interval.
The biased generator produces, with higher probability, potential problematic values that usually cause more bugs (empty and blank strings for example).
If none of the previous factory methods suit your needs, you can still create a JsStr generator from a string generator and the function map:
import fun.gen.Gen;
import jsonvalues.JsStr;
Gen<String> strGen = seed -> () -> {...};
Gen<JsStr> jsStrGen = gen.map(JsStr::of)
-
Method Summary
Modifier and TypeMethodDescriptionstatic fun.gen.Gen<JsStr>
Generator tha produces an alphabetic characterstatic fun.gen.Gen<JsStr>
alphabetic
(int length) Generates a string made up of alphabetic charactersstatic fun.gen.Gen<JsStr>
alphabetic
(int minLength, int maxLength) Generates a string made up of alphabetic charactersstatic fun.gen.Gen<JsStr>
Generator tha produces an alphanumeric characterstatic fun.gen.Gen<JsStr>
alphanumeric
(int length) Generates a string made up of alphanumeric charactersstatic fun.gen.Gen<JsStr>
alphanumeric
(int minLength, int maxLength) Generates a string made up of alphanumeric charactersReturns a supplier from the specified seed that generates a new JsStr each time it's calledstatic fun.gen.Gen<JsStr>
arbitrary
(int length) returns a generator that produces arbitrary stringsstatic fun.gen.Gen<JsStr>
arbitrary
(int minLength, int maxLength) returns a generator that produces arbitrary stringsstatic fun.gen.Gen<JsStr>
biased
(int length) returns a biased generators that produces, with higher probability, potential problematic values that usually cause more bugs.static fun.gen.Gen<JsStr>
biased
(int minLength, int maxLength) returns a biased generators that produces, with higher probability, potential problematic values that usually cause more bugs.static fun.gen.Gen<JsStr>
digit()
Generator tha produces a digit from 0 to 9static fun.gen.Gen<JsStr>
digits
(int length) Generates a string made up of digitsstatic fun.gen.Gen<JsStr>
digits
(int minLength, int maxLength) Generates a string made up of digitsstatic fun.gen.Gen<JsStr>
letter()
Generator tha produces a letter from a to zstatic fun.gen.Gen<JsStr>
letters
(int length) Generates a string made up of lettersstatic fun.gen.Gen<JsStr>
letters
(int minLength, int maxLength) Generates a string made up of lettersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface fun.gen.Gen
map, peek, sample, sample, sample, suchThat, suchThat, then
-
Method Details
-
digit
Generator tha produces a digit from 0 to 9- Returns:
- a JsStr generator
-
letter
Generator tha produces a letter from a to z- Returns:
- a JsStr generator
-
alphabetic
Generator tha produces an alphabetic character- Returns:
- a JsStr generator
-
alphanumeric
Generator tha produces an alphanumeric character- Returns:
- a JsStr generator
-
digits
Generates a string made up of digits- Parameters:
minLength
- minimum length of the stringmaxLength
- maximum length of the string (inclusive)- Returns:
- a string generator
-
digits
Generates a string made up of digits- Parameters:
length
- the length of the string- Returns:
- a string generator
-
letters
Generates a string made up of letters- Parameters:
minLength
- minimum length of the stringmaxLength
- maximum length of the string (inclusive)- Returns:
- a string generator
-
letters
Generates a string made up of letters- Parameters:
length
- length of the string- Returns:
- a string generator
-
alphabetic
Generates a string made up of alphabetic characters- Parameters:
minLength
- minimum length of the stringmaxLength
- maximum length of the string (inclusive)- Returns:
- a string generator
-
alphabetic
Generates a string made up of alphabetic characters- Parameters:
length
- length of the string- Returns:
- a string generator
-
alphanumeric
Generates a string made up of alphanumeric characters- Parameters:
minLength
- minimum length of the stringmaxLength
- maximum length of the string (inclusive)- Returns:
- a string generator
-
alphanumeric
Generates a string made up of alphanumeric characters- Parameters:
length
- length of the string- Returns:
- a string generator
-
arbitrary
returns a generator that produces arbitrary strings- Parameters:
minLength
- minimum length of the string (inclusive)maxLength
- maximum length of the string (inclusive)- Returns:
- a string generator
-
arbitrary
returns a generator that produces arbitrary strings- Parameters:
length
- of the string- Returns:
- a string generator
-
biased
returns a biased generators that produces, with higher probability, potential problematic values that usually cause more bugs. These values are:- empty string (if minLength is equal to zero) - blank string of length minLength - blank string of length maxLength - arbitrary string of length minLength - arbitrary string of length maxLength
- Parameters:
minLength
- minimum length of the string (inclusive)maxLength
- maximum length of the string (inclusive)- Returns:
- a string generator
-
biased
returns a biased generators that produces, with higher probability, potential problematic values that usually cause more bugs. These values are:- blank string
- Parameters:
length
- minimum length of the string (inclusive)- Returns:
- a string generator
-
apply
Returns a supplier from the specified seed that generates a new JsStr each time it's called
-