### Question:
PropertyAccessor { public void setPropertyValue(T boundObject, @CheckForNull V value) { writeMethod.writeValue(boundObject, value); } PropertyAccessor(Class<? extends T> boundClass, String propertyName); String getPropertyName(); V getPropertyValue(T boundObject); void setPropertyValue(T boundObject, @CheckForNull V value); void invoke(T boundObject); boolean canWrite(); boolean canInvoke(); boolean canRead(); Class<?> getValueClass();  }### Answer:
@Test public void testWrite() { assertEquals(STRING_PROPERTY_INITIAL_VALUE, testObject.getStringProperty()); stringAccessor.setPropertyValue(testObject, "anotherValue"); assertEquals("anotherValue", testObject.getStringProperty()); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void testWriteWrongType() { Assertions.assertThrows(RuntimeException.class, () -> { ((PropertyAccessor)stringAccessor).setPropertyValue(testObject, 5); }); }
@Test public void testSetPropertyValue_readOnlyProperty() { TestObject testObject2 = new TestObject(); PropertyAccessor<TestObject, Long> accessor = new PropertyAccessor<>(TestObject.class, TestObject.READ_ONLY_LONG_PROPERTY); Assertions.assertThrows(LinkkiBindingException.class, () -> { accessor.setPropertyValue(testObject2, 5L); }); }