private static class TestForm extends HtmlForm
{
@SuppressWarnings("unchecked")
public TestForm()
{
Group contact = requiredGroup(CONTACT);
contact.input(stringType(), SURNAME);
contact.input(stringType(), PHONE);
contact.input(stringType(), EMAIL, emailAddress()).optional();
Group metric = optionalGroup(METRIC);
metric.input(doubleType(), HEIGHT_M);
metric.input(intType(), WEIGHT_KG);
Group imperial = optionalGroup(IMPERIAL);
imperial.input(intType(), HEIGHT_FT);
imperial.input(intType(), HEIGHT_IN);
imperial.input(intType(), WEIGHT_LB);
try
{
Group duplicate = optionalGroup(IMPERIAL);
fail("Error - duplicate group name must throw an exception");
}
catch(DuplicateNameException ex) {}
}