PropertyChain
class in io.proptastic
abstract sealed class PropertyChain<S>What every forAll(…) chain says besides its examples: .via, .tries and
.seed. The typed parts, .example and .check, are on each arity’s class.
Methods
via
S via(String text)Where the example before this came from, .via("issue 123"): shown if it fails. The
mutastic: prefix is kept for counterexamples mutastic proposes.
tries
S tries(int n)Random tries after the examples; 100 unless said, and PROPTASTIC_TRIES wins.
seed
S seed(long n)The seed of the random tries, over PROPTASTIC_SEED: .seed(0x5eed).
exhaustively
S exhaustively()Runs every value the draws can take, once each, in place of random tries, so a pass has checked
them all: forAll(sides(), booleans()).exhaustively(). Draws with more than 100,000
values, such as a list, a string or an unbounded number, are refused (decision 47).
id
S id(String name)The property’s own name for its corpus, .id("fields-round-trip"): without one, the
corpus is keyed on the test’s class and method, so renaming or moving the test starts it
afresh. With one, the corpus goes where the property goes. Letters, digits, ., _ and -.
unreachable
S unreachable(String outcome, String reason)An outcome of the model the property follows that these draws can’t reach, and why: the run doesn’t ask for it, and the reason is printed. It fails if the outcome comes up after all.
allow
S allow(String check, String reason)A health check that’s fine for this property, and why: .allow("filter", "most strings aren't dates"). The check isn’t made. The checks are filter, large and slow (decision 46).