corda / net.corda.contracts.testing / ContractStateGenerator

ContractStateGenerator

class ContractStateGenerator : Generator<ContractState>

This file contains generators for quickcheck style testing. The idea is that we can write random instance generators for each type we have in the code and test against those instead of predefined mock data. This style of testing can catch corner case bugs and test algebraic properties of the code, for example deserialize(serialize(generatedThing)) == generatedThing

TODO add combinators for easier Generator writing

Constructors

<init> ContractStateGenerator()

This file contains generators for quickcheck style testing. The idea is that we can write random instance generators for each type we have in the code and test against those instead of predefined mock data. This style of testing can catch corner case bugs and test algebraic properties of the code, for example deserialize(serialize(generatedThing)) == generatedThing

Functions

generate fun generate(random: SourceOfRandomness, status: GenerationStatus): ContractState

Extension Functions

generateList fun <A> Generator<A>.generateList(random: SourceOfRandomness, status: GenerationStatus): List<A>

Generators for quickcheck