### Question:
BeanUtils { public static List<AnnotatedElement> getFieldsAndAccessors(Class<?> clazz) { final List<AnnotatedElement> properties = Arrays.stream(clazz.getDeclaredFields()).filter(f -> !f.isSynthetic()).collect(Collectors.toCollection(ArrayList::new)); try { Arrays.asList(Introspector.getBeanInfo(clazz, Object.class).getPropertyDescriptors()).forEach(prop -> { if (prop.getReadMethod() != null) { properties.add(prop.getReadMethod()); } if (prop.getWriteMethod() != null) { properties.add(prop.getWriteMethod()); } }); } catch (IntrospectionException ex) { throw new IllegalArgumentException(String.format("Could not parse properties from class %s", clazz), ex); } return properties; } private  BeanUtils(); static List<AnnotatedElement> getFieldsAndAccessors(Class<?> clazz);  }### Answer:
@Test public void shouldFindFieldsAndAccessors() { List<AnnotatedElement> fieldsAndAccessors = BeanUtils.getFieldsAndAccessors(SomeBean.class); assertThat(fieldsAndAccessors.size(), is(3)); fieldsAndAccessors.forEach(fieldsAndAccessor -> assertThat(fieldsAndAccessor.toString().toLowerCase(), containsString("foo")) ); }