Class CaptureRule


public class CaptureRule extends ObjectWithReflectiveEqualsHashCodeToString
Declarative capture rule (WS2.2): when an expectation matches an incoming request, each capture rule extracts a value from the request and stores it into scenario state under the into name, so a later request's response template can read it back via scenario.get(name) (WS2.1).

A rule has three parts:

  • source — where in the request to look (jsonPath, xpath, header, queryStringParameter, cookie, pathParameter).
  • expression — the selector evaluated against that source (a JSONPath / XPath expression, or a header / parameter / cookie name).
  • into — the scenario name whose state is set to the captured value.
This enables realistic auth→resource→confirm journeys without manual scenario-trigger calls.