### Question:
FieldGroup implements Serializable { public void bind(Field<?> field, Object propertyId) throws BindException { throwIfFieldIsNull(field, propertyId); throwIfPropertyIdAlreadyBound(field, propertyId); fieldToPropertyId.put(field, propertyId); propertyIdToField.put(propertyId, field); if (itemDataSource == null) { field.setPropertyDataSource(null); boolean fieldReadOnly = field.isReadOnly(); if (!fieldReadOnly) { field.clear(); } else { field.setReadOnly(false); field.clear(); field.setReadOnly(true); } return; } field.setPropertyDataSource(wrapInTransactionalProperty(getItemProperty(propertyId))); configureField(field); } FieldGroup();  FieldGroup(Item itemDataSource); void setItemDataSource(Item itemDataSource); Item getItemDataSource(); boolean isBuffered(); void setBuffered(boolean buffered); boolean isEnabled(); void setEnabled(boolean fieldsEnabled); boolean isReadOnly(); void setReadOnly(boolean fieldsReadOnly); Collection<Field<?>> getFields(); void bind(Field<?> field, Object propertyId); void unbind(Field<?> field); Collection<Object> getBoundPropertyIds(); Collection<Object> getUnboundPropertyIds(); void commit(); void discard(); Field<?> getField(Object propertyId); Object getPropertyId(Field<?> field); void addCommitHandler(CommitHandler commitHandler); void removeCommitHandler(CommitHandler commitHandler); boolean isValid(); boolean isModified(); FieldGroupFieldFactory getFieldFactory(); void setFieldFactory(FieldGroupFieldFactory fieldFactory); void bindMemberFields(Object objectWithMemberFields); void buildAndBindMemberFields(Object objectWithMemberFields); Field<?> buildAndBind(Object propertyId); Field<?> buildAndBind(String caption, Object propertyId); T buildAndBind(String caption, Object propertyId,
            Class<T> fieldType); void clear();  }### Answer:
@Test(expected = FieldGroup.BindException.class) public void cannotBindToAlreadyBoundProperty() { sut.bind(field, "foobar"); sut.bind(mock(Field.class), "foobar"); }
@Test(expected = FieldGroup.BindException.class) public void cannotBindNullField() { sut.bind(null, "foobar"); }