### Question:
Form extends AbstractForm<T> { void visitItem(final String name, FormItemVisitor visitor) { String namePrefix = name + "_"; for(Map<String, FormItem> groupItems : formItems.values()) { for(String key : groupItems.keySet()) { if(key.equals(name) || key.startsWith(namePrefix)) { visitor.visit(groupItems.get(key)); } } } } Form(Class<?> conversionType); Class<?> getConversionType(); void cancel(); void edit(T bean); void addEditListener(EditListener listener); void removeEditListener(EditListener listener); Map<String, Object> getChangedValues(); T getUpdatedEntity(); void clearValues(); T getEditedEntity(); static Map<String,String> getExpressions(Object bean);  }### Answer:
@Test public void testVisitItem() { Form<Integer> f = new Form<Integer>(Integer.class); FormItem<String> item = new TextBoxItem("hello", "Hello"); FormItem<String> item2 = new TextBoxItem("helloThere", "Hello There"); FormItem<String> item3 = new TextBoxItem("hello_7", "Hello"); f.setFieldsInGroup("default", item, item2, item3); final List<FormItem<?>> visited = new ArrayList<FormItem<?>>(); Form.FormItemVisitor visitor = new Form.FormItemVisitor() { @Override public void visit(FormItem item) { visited.add(item); } }; f.visitItem("hello", visitor); assertEquals(2, visited.size()); assertTrue(visited.contains(item)); assertTrue(visited.contains(item3)); visited.clear(); f.visitItem("helloThere", visitor); assertEquals(1, visited.size()); assertSame(item2, visited.get(0)); }