@NotThreadSafe public class Randomizer extends Object implements org.junit.rules.TestRule
| Constructor and Description |
|---|
Randomizer() |
| Modifier and Type | Method and Description |
|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
Random |
getRandom() |
String |
randomAsciiOfLength(int count)
Creates a random string whose length is the number of characters
specified.
|
boolean |
randomBoolean() |
int |
randomInt() |
int |
randomInt(int max)
A random integer between 0 and
max (inclusive). |
int |
randomIntBetween(int min,
int max)
A random integer from
min to max (inclusive). |
boolean |
rarely()
Rarely returns
true in about 10% of all calls. |
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
apply in interface org.junit.rules.TestRulepublic int randomIntBetween(int min,
int max)
min to max (inclusive).public int randomInt(int max)
max (inclusive).public boolean randomBoolean()
public int randomInt()
public String randomAsciiOfLength(int count)
RandomStringUtils which does not
support providing a source of randomness. So this method does not
use the same seed as other methods in this class.public boolean rarely()
true in about 10% of all calls.public Random getRandom()
Copyright © 2019. All rights reserved.