Stub Decision Service
A decision service for tests that returns scripted outcomes and records each call.
Outcomes for ask, rate and question assess calls are scripted by question name, and outcomes for assess calls with a PropositionRequest by proposition text. classify returns the choice scripted for the request's question name, and otherwise the classification scripted for its set of category ids. A call with no scripted outcome throws IllegalStateException.
By default the stub answers a whole request in one question-set call. Question-set answers pass through the same question validation as provider answers, so a scripted choice outside its question's options, or rating evidence outside its levels, throws IllegalStateException from ask. A stub built after Builder.perQuestion answers each question on its own: a choice question through classify, and the other kinds through their per-question hooks. The stub accepts every question kind unless other capabilities are set.
val stub = StubDecisionService.builder("triage-stub")
.proposition("is_urgent", PropositionResult.Answered(true, provenance))
.build()Types
Collects scripted outcomes for a StubDecisionService. Get one from StubDecisionService.builder. A later outcome for the same key replaces the earlier one.
Functions
Answers a request.
Answers the questions of a spec against the given input. It behaves as ask with a request.
Assess the proposition; a false answer is successful evidence, not an operational failure.
Answers one proposition question in its own provider call.
Returns what this service can accept.
Classifies text with a spec. Same as calling classify with ClassificationRequest.of(input, spec).
Classify text using only the request's category domain, returning evidence rather than routing policy.
Pure DECISION metadata snapshot; never serialize a live service in place of this value.
Rates the input against one rating question in its own provider call. The caller validates the outcome against the question's levels.