### Question:
BeanFieldGroup extends FieldGroup { @Override protected Class<?> getPropertyType(Object propertyId) { if (getItemDataSource() != null) { return super.getPropertyType(propertyId); } else { try { Class<?> type = BeanUtil.getPropertyType(beanType, propertyId.toString()); if (type == null) { throw new BindException( "Cannot determine type of propertyId '" + propertyId + "'. The propertyId was not found in " + beanType.getName()); } return type; } catch (IntrospectionException e) { throw new BindException("Cannot determine type of propertyId '" + propertyId + "'. Unable to introspect " + beanType, e); } } } BeanFieldGroup(Class<T> beanType); void setItemDataSource(T bean); @Override void setItemDataSource(Item item); @Override BeanItem<T> getItemDataSource(); @Override void bind(Field field, Object propertyId); @Override T buildAndBind(String caption, Object propertyId,
            Class<T> fieldType); @Override void unbind(Field<?> field); static BeanFieldGroup<T> bindFieldsUnbuffered(T bean,
            Object objectWithMemberFields); static BeanFieldGroup<T> bindFieldsBuffered(T bean,
            Object objectWithMemberFields);  }### Answer:
@Test public void propertyTypeWithoutItem() { BeanFieldGroup<Sub2> s = new BeanFieldGroup<BeanFieldGroupTest.Sub2>( Sub2.class); Assert.assertEquals(boolean.class, s.getPropertyType("sub2field")); Assert.assertEquals(Integer.class, s.getPropertyType("sub1Field")); Assert.assertEquals(String.class, s.getPropertyType("mainField")); }
@Test public void propertyTypeWithoutItem() { BeanFieldGroup<Sub2> s = new BeanFieldGroup<BeanFieldGroupTest.Sub2>( Sub2.class); assertEquals(boolean.class, s.getPropertyType("sub2field")); assertEquals(Integer.class, s.getPropertyType("sub1Field")); assertEquals(String.class, s.getPropertyType("mainField")); }