### Question:
ReflectivePropertyAccessor implements PropertyAccessor { @Override public Object read(final EvaluationContext context, final Object target, final String name) throws AccessException { Objects.requireNonNull(target, "target cannot be null"); Objects.requireNonNull(name, "name cannot be null"); Class<?> type = (target instanceof Class) ? (Class<?>) target : target.getClass(); try { Method method = findGetterMethodForProperty(type, name); if (method != null || (method = findAccessMethodForProperty(type, name)) != null) { method.setAccessible(true); return method.invoke(target); } } catch (Exception e) { throw new AccessException(e.getMessage()); } throw new AccessException( String.format( "Cannot found getter method for attribute '%s' on class '%s'", name, target.getClass())); }  @Override boolean canRead(final EvaluationContext context,
                           final Object target,
                           final String name); @Override Object read(final EvaluationContext context,
                       final Object target,
                       final String name); @Override void write(final EvaluationContext context,
                      final Object target,
                      final String name,
                      final Object newValue); @Override boolean canWrite(final EvaluationContext context,
                            final Object target,
                            final String name);  }### Answer:
@Test(expected = AccessException.class) public void should_thrown_when_reading_invalid_property_using_getter_method_given_pojo() { ReflectivePropertyAccessor accessor = new ReflectivePropertyAccessor(); accessor.read(context, new DummyObject("foo"), "unknown"); }
@Test public void should_read_property_using_getter_method_given_pojo() { ReflectivePropertyAccessor accessor = new ReflectivePropertyAccessor(); Object object = accessor.read(context, new DummyObject("foo"), "field"); Assert.assertEquals("foo", object); }