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 ie 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
如果您有适当的getter访问值,则可以使用filter ,也可以使用lambda:
assertThat(tests).filteredOn("change", true).hasSize(200);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.