form.add(doubleField);
Checkbox checkBox = new Checkbox("boolean");
form.add(checkBox);
LongField telephoneField = new LongField("telephone");
form.add(telephoneField);
HiddenField hidden = new HiddenField("hidden", String.class);
form.add(hidden);
// Populate fields
idField.setValueObject(ID);
nameField.setValue(NAME);
dateField.setValueObject(DATE_OF_BIRTH);
intField.setValue(String.valueOf(INT));
doubleField.setValue(String.valueOf(DOUBLE));
checkBox.setChecked(BOOLEAN);
telephoneField.setValue(TELEPHONE);
// copy form to object
SampleObject sampleObject = new SampleObject();
ClickUtils.copyFormToObject(form, sampleObject, true);
// has the object been configured correctly?
assertEquals(idField.getInteger(), sampleObject.getId());
assertEquals(nameField.getValue(), sampleObject.getName());
assertEquals(dateField.getValueObject(), sampleObject.getDateOfBirth());
assertEquals(telephoneField.getValueObject().toString(), sampleObject.getTelephone());
assertTrue(sampleObject.getInt() == intField.getInteger().intValue());
assertTrue(sampleObject.getDouble() == doubleField.getDouble().doubleValue());
assertTrue(sampleObject.isBoolean() == checkBox.isChecked());
// Test object path copying