A state space is the set of all possible combinations of values representing a domain or program. Making that space explicit reveals which states remain untested and which invariants the system must preserve. section 11.5
Counting a small domain
Suppose a record contains an optional Policy with five values, an optional AuditFinding with four, and an optional Boolean. Including each Optional.empty state produces 6 × 5 × 3 = 90 possible states. Generating those states can be practical when the modeled space is small. section 7.5.1
Example-based tests exercise selected points in the space. Randomized tests explore broader regions and can express that an invariant should hold for every generated state. The useful target is not unrestricted randomness: generators should cover business-relevant subsets without becoming so prescriptive that they lose exploratory value. section 11.5 section 11.5.2
From examples to generated states
A discount test can generate accounts above, at, and below a threshold, combine those subsets, and then assert the rule over the resulting set. A larger generator can create many accounts first, derive the expected subset from the business predicate, and compare the service result against it.



