The operations lead at fictional Ash Retail wants a maintainable order-adjustment service. Inputs are line amounts, a per-line discount and a final cap. Build the behavior in six stages, retain the previous stage as the next starter, and finish with distinct validation signals and executable characterization assertions. Completion means all behavior checks pass, including the new boundary introduced at each stage.
Ash Retail needs a pricing routine that can change without losing its earlier guarantees. Begin with a characterization baseline, then add one rule at a time. Every step starts from the exact previous source, and each requirement includes a case that the previous implementation can't yet handle.
The project extracts a per-line adjustment, rejects invalid source amounts, introduces a small strategy boundary, adds an order-level cap and executes two characterization assertions. Preserve the zero floor and error signals while those responsibilities move. The public method remains stable so its behavioral tests can keep checking the same boundary. This is a plain-Java refactor with a small assertion helper. A production Spring Boot service or JPA repository would also need framework configuration and integration tests, neither of which runs in this workspace.