Exemplo n.º 1
0
  public static String word(Integer length) {
    String word = null;
    length = getValidLength(length, new NumberRange(3, 20));

    if (length == 1) {
      word = pickChar();
    } else {
      word = pickCollection(Dictionary.getWordsByLength(length));
    }

    if (word == null) {
      word = RandomStringUtils.randomAlphanumeric(length);
    }

    return word;
  }
Exemplo n.º 2
0
 public static String lastName(Integer length) {
   length = getValidLength(length, new NumberRange(3, 10));
   return pickCollection(Dictionary.getLastNameByLength(length));
 }
Exemplo n.º 3
0
 public static String firstName(Integer length, Gender gender) {
   length = getValidLength(length, new NumberRange(3, 10));
   return gender.equals(Gender.MALE)
       ? pickCollection(Dictionary.getMaleNameByLength(length))
       : pickCollection(Dictionary.getFemaleNameByLength(length));
 }