public final class JsStrGen extends Object implements fun.gen.Gen<JsStr>
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)
Modifier and Type | Method and Description |
---|---|
static fun.gen.Gen<JsStr> |
alphabetic()
Generator tha produces an alphabetic character
|
static fun.gen.Gen<JsStr> |
alphabetic(int minLength,
int maxLength)
Generates a string made up of alphabetic characters
|
static fun.gen.Gen<JsStr> |
alphanumeric()
Generator tha produces an alphanumeric character
|
static fun.gen.Gen<JsStr> |
alphanumeric(int minLength,
int maxLength)
Generates a string made up of alphanumeric characters
|
Supplier<JsStr> |
apply(Random seed)
Returns a supplier from the specified seed that generates a new JsStr each time it's called
|
static fun.gen.Gen<JsStr> |
arbitrary(int minLength,
int maxLength)
returns a generator that produces arbitrary strings
|
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 9
|
static fun.gen.Gen<JsStr> |
digits(int minLength,
int maxLength)
Generates a string made up of digits
|
static fun.gen.Gen<JsStr> |
letter()
Generator tha produces a letter from a to z
|
static fun.gen.Gen<JsStr> |
letters(int minLength,
int maxLength)
Generates a string made up of letters
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static fun.gen.Gen<JsStr> digit()
public static fun.gen.Gen<JsStr> letter()
public static fun.gen.Gen<JsStr> alphabetic()
public static fun.gen.Gen<JsStr> alphanumeric()
public static fun.gen.Gen<JsStr> digits(int minLength, int maxLength)
minLength
- minimum length of the stringmaxLength
- maximum length of the string (inclusive)public static fun.gen.Gen<JsStr> letters(int minLength, int maxLength)
minLength
- minimum length of the stringmaxLength
- maximum length of the string (inclusive)public static fun.gen.Gen<JsStr> alphabetic(int minLength, int maxLength)
minLength
- minimum length of the stringmaxLength
- maximum length of the string (inclusive)public static fun.gen.Gen<JsStr> alphanumeric(int minLength, int maxLength)
minLength
- minimum length of the stringmaxLength
- maximum length of the string (inclusive)public static fun.gen.Gen<JsStr> arbitrary(int minLength, int maxLength)
minLength
- minimum length of the string (inclusive)maxLength
- maximum length of the string (inclusive)public static fun.gen.Gen<JsStr> biased(int minLength, int maxLength)
- 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
minLength
- minimum length of the string (inclusive)maxLength
- maximum length of the string (inclusive)Copyright © 2022. All rights reserved.