AssertJ is very nice for test-driven-development or commonly testing in Java and today I figured out a mindblowing feature. And to be honest, if I had read the documentation, I would have known it already 😎
class Item {
// ...
}
class Table {
int legs;
String color;
List<Item> servedItems;
// ... Ctor, Getter, Setter
}
Table table = new Table(4, "brown", Arrays.asList(new Item(/* ... */), new Item(/* ... */)));
assertThat(table)
.extracting("color", "servedItems.size")
.containsExactly("brown", 2);
In the example you can see: It's possible to access the item list in table as String in dot notation. 🤯 Nice job girls and boys from AssertJ

