Search code examples
javajqwik

How to specify @ForAll non-zero integers?


How can I specify @ForAll non-zero integers (i.e. either include both positive and negative integers, or exclude 0 from the integer range)? I couldn't find anything from https://jqwik.net/docs/current/user-guide.html#integer-constraints.


Solution

  • In recent versions you can use:

    Arbitraries.integers().filter(i -> i != 0)