### Question:
PropertyUtil { public static Method getReadMethod(Object bean, String name) { try { Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass("org.apache.commons.beanutils.PropertyUtils"); Method method = clazz.getMethod("getPropertyDescriptor", Object.class, String.class); Object descriptor = method.invoke(null, bean, name); if (descriptor == null) { throw new ActiveJpaException("Property descriptor not found for the field - " + name); } method = clazz.getMethod("getReadMethod", PropertyDescriptor.class); return (Method) method.invoke(null, descriptor); } catch (Exception e) { throw new ActiveJpaException("Failed while getting the property descriptor", e); } } private  PropertyUtil(); static boolean isSimpleProperty(Class<?> clazz); static boolean isSimpleValueType(Class<?> clazz); static boolean isCollectionProperty(Type type, boolean includeMaps); static boolean isCollectionProperty(Class<?> clazz, boolean includeMaps); static boolean isMapProperty(Type type); static boolean isMapProperty(Class<?> clazz); static Class<?> getCollectionElementType(Type type); static Object getProperty(Object bean, String name); static void setProperty(Object bean, String name, Object value); static Method getReadMethod(Object bean, String name); static Boolean isPrimitiveOrWrapper(Class<?> clazz);  }### Answer:
@Test public void shouldGetReadMethod() { DummyClass clazz = new DummyClass(); assertNotNull(PropertyUtil.getReadMethod(clazz, "fieldWithGetter")); }
@Test public void shouldNotGetReadMethod() { DummyClass clazz = new DummyClass(); try { PropertyUtil.getReadMethod(clazz, "fieldWithoutGetter"); fail("Expected exception but got none"); } catch (ActiveJpaException e) { } }