Handles
class in io.proptastic
class Handles<T> implements Argument<Object, T>Values a step makes that later steps use, such as an account it opens: var accounts = handles("account"). A step keeps one with keep, .step("open", bank -> accounts.keep(bank.open())); as another step’s argument, .step("deposit", accounts, amounts(), Bank::deposit), the handles draw one the run kept and hasn’t dropped. A step with
none to draw is skipped, as one whose precondition doesn’t hold.
A failure names each by its order, var account1 = open() then deposit(account1, 1), and pins it step("deposit", handle("account", 1), 1L). The pick is a choice among
the live ones, the first kept the simplest, so when shrinking deletes the step that made one, the
steps that used it use another, or are skipped when none is left.
Parameters
<T> | the values kept |
|---|
Methods
keep
T keep(T value)Keeps value, which the step running made, for later steps to draw: accounts.keep(bank.open()). Returns it. Outside a step it does nothing.
drop
void drop(T value)The step running is done with value, such as an account it closed: no later step draws
it. Each live handle holding a value equals to it goes. Outside a step it does nothing.