Hamcrest至少有一场比赛-使用anyOf吗?

时间:2019-12-11 10:22:16

标签: java testing hamcrest

有时我使用anyOf(Matcher..)检查2个复杂对象的列表或元素。我知道给定的项目应该随机分布在两个列表中-或这些复杂对象的字段中。 如何检查是否缺少任何物品。

例如我当前的问题:

assertThat(lewcc1.size(), is(2));
assertThat(lewcc1.get(0).getCompanyCodes().size(), is(1));
assertThat(lewcc1.get(1).getCompanyCodes().size(), is(1));
assertThat(lewcc1.get(0).getLegalEntity(), Matchers.anyOf(is(le1Domain), is(leNotExist)));
assertThat(lewcc1.get(1).getLegalEntity(), Matchers.anyOf(is(le1Domain), is(leNotExist)));

那么如何检查我是否完全匹配-le1DomainleNotExist一个至少一个

Hamcrest是否可以检查此方法?

0 个答案:

没有答案