Example #1
0
  protected static String randomString(int len) {
    StringBuilder sb = new StringBuilder();

    // create some randomness so we always make a brand spanking new string/name/loginname/etc
    for (int i = 0; i < len; i++) sb.append((char) ('a' + (Math.random() * ('z' - 'a' + 0.5))));

    return sb.toString();
  }
Example #2
0
  private static void fillInCategoricalQuestions(Robot robot) {
    DialogFixture dialog =
        WindowFinder.findDialog("Category Options").withTimeout(10000).using(robot);
    JComboBoxFixture cmbF = dialog.comboBox();
    String[] poss = cmbF.contents();

    int sel = (int) (Math.random() * poss.length);
    cmbF.selectItem(sel);
    dialog.button(withText("OK")).click();
  }