public void testGetByValue() throws Exception {
Map<String, String> choices = new HashMap<String, String>();
choices.put("J", "John");
choices.put("P", "Paul");
Field<String> f = new SelectField(injector.getInstance(WidgetFactory.class)).setChoices(choices).setName("choice_field");
Map<String, String> errors = new HashMap<String, String>();
assertEquals("J", f.clean(new String[]{"J"}, errors));
assertTrue(errors.isEmpty());