StepBuilder
annotation in io.proptastic
@interface StepBuilderGenerates typed steps for a stateful test from an interface of them: each abstract method is a
step, named by the method, its arguments typed by its parameters. For @StepBuilder interface Banking, proptastic’s annotation processor writes two classes beside it:
BankingSteps, the steps:BankingSteps.steps(Accounts::new).deposit(people(), amounts()), aStepswhose every step calls that method on a state that implementsBanking, then.whenand.invariantas on any steps;BankingStep, one step, for a pin:.example(deposit("alice", 1L), …)withimport static bank.BankingStep.*, as a failure’spin it:line writes it.
A value a step makes that later steps use is a Handle: @Handle("account") long open() keeps what it returns, deposit(@Handle("account") long account, long amount)
draws one, and BankingStep.account(1) names the first in a pin, .example(open(), deposit(account(1), 1L)).
A renamed step, or one whose arguments change, then breaks the test and its pins when they’re
compiled, not when they run. The processor runs when proptastic is on the annotation processor
path: Gradle’s testAnnotationProcessor, or Maven’s annotationProcessorPaths.