Some time I am using anyOf(Matcher..)
to check for example 2 lists or elements of complex objects. I know given items should be randomly distributed in both lists - or in fields of these complex objects. How to check that no item is missing.
For example my current problem:
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)));
So how to check if I have exactly one or at least one match for - le1Domain
and leNotExist
?
Is there a way with Hamcrest to check this?
Aucun commentaire:
Enregistrer un commentaire