Vavr property testing

泪湿孤枕 提交于 2019-12-08 02:20:56

问题


Property checking feature is advertised in the latest Vavr documentation along with the following example of its usage:

Arbitrary<Integer> ints = Arbitrary.integer();

// square(int) >= 0: OK, passed 1000 tests.
Property.def("square(int) >= 0")
        .forAll(ints)
        .suchThat(i -> i * i >= 0)
        .check()
        .assertIsSatisfied();

However, as per the library's javadoc, neither Arbitrary generator nor Property type exist.

What am I missing, if any? Is the documentation up to date?


回答1:


Turns out, the following vavr-test dependency was missing, which is not obvious from Vavr documentation:

<dependency>
    <groupId>io.vavr</groupId>
    <artifactId>vavr-test</artifactId>
    <version>0.9.1</version>
</dependency>


来源:https://stackoverflow.com/questions/48629111/vavr-property-testing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!