### Question:
ObjectProperty extends AbstractProperty<T> { @Override public T getValue() { return value; } @SuppressWarnings("unchecked") // the cast is safe, because an object of type T has class Class<T>  ObjectProperty(T value);  ObjectProperty(T value, Class<T> type);  ObjectProperty(T value, Class<T> type, boolean readOnly); @Override final Class<T> getType(); @Override T getValue(); @Override void setValue(T newValue);  }### Answer:
@Test public void testSimple() { ObjectProperty<TestSuperClass> prop1 = new ObjectProperty<TestSuperClass>( super1, TestSuperClass.class); Assert.assertEquals("super1", prop1.getValue().getName()); prop1 = new ObjectProperty<TestSuperClass>(super1); Assert.assertEquals("super1", prop1.getValue().getName()); ObjectProperty<TestSubClass> prop2 = new ObjectProperty<TestSubClass>( sub1, TestSubClass.class); Assert.assertEquals("Subclass: sub1", prop2.getValue().getName()); prop2 = new ObjectProperty<TestSubClass>(sub1); Assert.assertEquals("Subclass: sub1", prop2.getValue().getName()); }
@Test public void testSimple() { ObjectProperty<TestSuperClass> prop1 = new ObjectProperty<TestSuperClass>( super1, TestSuperClass.class); assertEquals("super1", prop1.getValue().getName()); prop1 = new ObjectProperty<TestSuperClass>(super1); assertEquals("super1", prop1.getValue().getName()); ObjectProperty<TestSubClass> prop2 = new ObjectProperty<TestSubClass>( sub1, TestSubClass.class); assertEquals("Subclass: sub1", prop2.getValue().getName()); prop2 = new ObjectProperty<TestSubClass>(sub1); assertEquals("Subclass: sub1", prop2.getValue().getName()); }