### Question:
BeanItem extends PropertysetItem { public BT getBean() { return bean; } BeanItem(BT bean);  BeanItem(BT bean, Class<BT> beanClass);   BeanItem(BT bean,
            Map<String, VaadinPropertyDescriptor<BT>> propertyDescriptors);  BeanItem(BT bean, Collection<?> propertyIds);  BeanItem(BT bean, String... propertyIds); void expandProperty(String propertyId, String... subPropertyIds); void addNestedProperty(String nestedPropertyId); BT getBean();  }### Answer:
@Test public void testOverridingProperties() { BeanItem<MyClass2> item = new BeanItem<MyClass2>(new MyClass2("bean2")); Collection<?> itemPropertyIds = item.getItemPropertyIds(); Assert.assertEquals(6, itemPropertyIds.size()); Assert.assertTrue(MyClass2.class.equals(item.getBean().getClass())); Assert.assertFalse(item.getItemProperty("name2").isReadOnly()); }
@Test public void testAddRemoveProperty() throws Exception { MethodPropertyDescriptor<BeanItemTest.MyClass> pd = new MethodPropertyDescriptor<BeanItemTest.MyClass>( "myname", MyClass.class, MyClass.class.getDeclaredMethod("getName"), MyClass.class.getDeclaredMethod("setName", String.class)); BeanItem<MyClass> item = new BeanItem<MyClass>(new MyClass("bean1")); Assert.assertEquals(6, item.getItemPropertyIds().size()); Assert.assertEquals(null, item.getItemProperty("myname")); item.addItemProperty("myname", pd.createProperty(item.getBean())); Assert.assertEquals(7, item.getItemPropertyIds().size()); Assert.assertEquals("bean1", item.getItemProperty("myname").getValue()); item.removeItemProperty("myname"); Assert.assertEquals(6, item.getItemPropertyIds().size()); Assert.assertEquals(null, item.getItemProperty("myname")); }