Closed GoGoris closed 8 years ago
Hi GoGoris,
there is no #doesNotContainZero()
method in assertj as far as I know, and NumberAssertions are just for single numbers, while extracting "returns" a collection. You can check that the values do not contain zero by using:
assertThat(Collections.<BigInteger>emptyList()).extracting(BigInteger::intValue).doesNotContain(0);
There are other methods to check that all values / at least one value etc. meet a condition e.g.
assertThat(Collections.<BigInteger>emptyList()).extracting(BigInteger::intValue).allMatch(i -> i > 0 && i < 10).areAtLeastOne(new Condition<>(i -> i == 5, "contains at least one 5"));
Cheers, Pascal
@GoGoris I'm closing this issue as @PascalSchumacher's answer shows how to address your request and because this project is only the website. If you feel the answer is not satisfying please raise an issue in assertj-core.
Hi, I noticed that when I use extracting(), there are no NumberAssertions. I have numeric collections with ints and doubles and it would be very handy if I could do doesNotContainZero() or other numeric asserts.
Example:
assertThat(Collections.<BigInteger>emptyList()).extracting(BigInteger::intValue).doesNotContainZero()