fest-assert-2.x
                                
                                 fest-assert-2.x copied to clipboard
                                
                                    fest-assert-2.x copied to clipboard
                            
                            
                            
                        Feature request: support for name() instead of getName() style setters for extractProperty
Your nice library only supports properties of the form getX setX, so this doesn't work
public class Foo {
   final protected String bar;
   public Foo(String bar) { this.bar = bar; }
   public String bar() { return bar }
}
final ArrayList<Foo> fooList = newArrayList(new Foo("a"),
                         new Foo("b"), new Foo("c"));
assertThat(extractProperty("bar", String.class)
      .from(fooList)).containsOnly("a","b", "c");
It would be very nice (for me :^) ) if we could test code with methods named like that?
It is also not possible to test non public methods or private classes. In principle this shouldn't be a problem, reflection APIs can call private members.
I would agree on getting properties with non java bean properties accessors but I'm not convinced breaking encapsulation by calling private methods is right (others might have another opinion).
Well maybe "private" doesn't make much sense, but for instance I very often give "internal APIs" methods with "package" visibility which are then exposed only to the internal classes building on that API. To me it makes sense to the this internal API.
What do you think?
Please use FEST-Reflect. It can access fields, properties, methods and more, via Reflection. It provides a nice fluent interface too.
@alexruiz thanks! that is good enough for me, feel free to close the issue