|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tapestry5.test.RandomDataSource
public final class RandomDataSource
Provides access to random data that can be used when populating a test database with "reasonable" data. The majority of this is access to random words from an american english dictionary, which can be strung together to form names, sentences and paragraphs.
Constructor Summary | |
---|---|
RandomDataSource()
|
Method Summary | ||
---|---|---|
String |
capitalizedWord()
Returns a random word, capitalized. |
|
boolean |
maybe(int percent)
|
|
|
oneOf(Class<T> enumClass)
Returns a random enum value, given the enum type. |
|
|
oneOf(T... values)
Returns a random value from the list of values supplied. |
|
String |
paragraph(int minSentences,
int maxSentences,
int minWords,
int maxWords)
Strings together a random number of word lists (in sentence form) to create something that looks like a paragraph. |
|
int |
random(int min,
int max)
|
|
String |
safeWord()
Returns a word that is "safe" for use in an email address. |
|
String |
word()
Returns a random word frm the dictionary. |
|
String |
wordList(int minWords,
int maxWords,
boolean asSentence)
Creates a space-separated list of random words. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomDataSource()
Method Detail |
---|
public boolean maybe(int percent)
public int random(int min, int max)
public String word()
public String capitalizedWord()
public String safeWord()
public <T> T oneOf(T... values)
public <T extends Enum> T oneOf(Class<T> enumClass)
public String wordList(int minWords, int maxWords, boolean asSentence)
minWords
- minimun number of words in the listmaxWords
- maximum number of words in the listasSentence
- if true, the output is "dressed up" as a non-sensical sentence
public String paragraph(int minSentences, int maxSentences, int minWords, int maxWords)
minSentences
- per paragraphmaxSentences
- per paragraphminWords
- per sentencemaxWords
- per sentence
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |