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; }
public static String lastName(Integer length) { length = getValidLength(length, new NumberRange(3, 10)); return pickCollection(Dictionary.getLastNameByLength(length)); }
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)); }