AttributeDescriptor { public boolean validateReadType(Class targetType) { try { getReadMember(targetType); return true; } catch (NameNotFoundException e) { return false; } } AttributeDescriptor(TypeRegistry pdxRegistry, String name); boolean validateReadType(Class targetType); Object read(Object target, ExecutionContext executionContext);  }
@Test @Parameters({PUBLIC_NO_ACCESSORS, PUBLIC_ACCESSOR_BY_NAME, PUBLIC_ACCESSOR_BY_GETTER, PRIVATE_ACCESSOR_BY_NAME, PRIVATE_ACCESSOR_BY_GETTER}) public void validateReadTypeShouldReturnTrueWhenMemberCanBeFound(String attributeName) { AttributeDescriptor attributeDescriptor = new AttributeDescriptor(typeRegistry, attributeName); assertThat(attributeDescriptor.validateReadType(TestBean.class)).isTrue(); }
@Test public void validateReadTypeShouldReturnFalseWhenMemberCanNotBeFound() { AttributeDescriptor attributeDescriptor = new AttributeDescriptor(typeRegistry, "nonExistingAttribute"); assertThat(attributeDescriptor.validateReadType(TestBean.class)).isFalse(); }