1
class Test{
private Boolean isChange;

}
Assume that tests list contains 1000 objets.

List<Test> tests = new ArrayList<Test>();
Test t  = new Test();
t.setIschange(true);
tests.add(t);

like that I have added 200 objects as true i.e isChanges value, remaining all are false out of 1000; and it will change to 300 like.

so how to check wheather list contains 200 objects isChange value is true using assertJ

Venkata Rama Raju
  • 1,325
  • 2
  • 10
  • 15

1 Answers1

3

You can use filter if you have a proper getter to access the value, or use a lambda:

assertThat(tests).filteredOn("change", true).hasSize(200);
Joel Costigliola
  • 6,308
  • 27
  • 35