GUI implements Serializable { public Object select(String id, ParamOption[] options, Object defaultValue) { if (defaultValue == null && options != null && options.length > 0) { defaultValue = options[0].getValue(); } forms.put(id, new Select(id, defaultValue, options)); Object value = params.get(id); if (value == null) { value = defaultValue; } params.put(id, value); return value; } GUI(); void setParams(Map<String, Object> values); Map<String, Object> getParams(); Map<String, Input> getForms(); void setForms(Map<String, Input> forms); @Deprecated Object input(String id); @Deprecated Object input(String id, Object defaultValue); Object textbox(String id, String defaultValue); Object textbox(String id); Object password(String id); Object select(String id, ParamOption[] options, Object defaultValue); List<Object> checkbox(String id,
                               ParamOption[] options,
                               Collection<Object> defaultChecked); void clear(); @Override boolean equals(Object o); @Override int hashCode(); String toJson(); void convertOldInput(); static GUI fromJson(String json);  }
@Test public void testSelect() { GUI gui = new GUI(); Object selected = gui.select("list_1", options, null); assertEquals("1", selected); gui = new GUI(); selected = gui.select("list_1", options, "2"); assertEquals("2", selected); selected = gui.select("list_1", options, "1"); assertEquals("2", selected); }