Skip to content

StatefulProperty

class in io.proptastic

class StatefulProperty<S>

A stateful test, from forAll(steps): .tries, .seed, .id and .example as on any property, then .check(), whose check is the invariants and the steps’ own assertions.

Parameters

<S>the state the steps are taken on

Methods

example

StatefulProperty<S> example(Object... steps)

Steps to take, in order, before the random tries: each step("deposit", "alice", 1L), or for record steps a record, as a failure’s pin it: line gives them.

follows

void follows(Spec<S> spec)

Runs it now against spec: after every step, the step taken must be one the spec allows from the state before it. Then the floor: every action of the spec came up, or is .unreachable. A pass prints what was followed.

threads

ThreadedProperty<S> threads(int count)

The steps on count threads at once, sharing one state: each try draws every thread’s steps and runs them on every schedule proptastic tries, checking that the threads’ answers fit some order of the steps one at a time. Before .example.

check

void check()

Runs it now: throws with the shrunk steps if an invariant breaks or a step fails.

Privacy