public void testLongGetByValue() throws Exception {
Map<Long, String> choices = new HashMap<Long, String>();
choices.put(1L, "John");
choices.put(2L, "Paul");
Field f = (injector.getInstance(LongSelectField.class)).setChoices(choices).setName("choice_field");
Map<String, String> errors = new HashMap<String, String>();
assertEquals(1L, f.clean(new String[]{"1"}, errors));
assertTrue(errors.isEmpty());
errors = new HashMap<String, String>();
f.clean(new String[]{"John"}, errors);
assertEquals("Select a valid choice. That choice is not one of the available choices.", errors.get("choice_field"));
}