Map<String, String> choices = new LinkedHashMap<String, String>();
choices.put("1", "One");
choices.put("2", "Two");
SelectWidget w = new SelectWidget();
ChoiceField field = (ChoiceField) new SelectField(injector.getInstance(WidgetFactory.class)).setChoices(choices).setAllowNull(false).setName("pickme");
// w.setField(field);
String[] o = w.valueFromMap(postData, "pickme");
assertEquals("2", o[0]);
Map<String, String> errors = new HashMap<String, String>();
Object cleaned = field.clean(o, errors);
assertTrue(errors.isEmpty());
assertEquals("2", cleaned);
}