Package akka.javasdk.testkit.eval
Class ToolBindings
Object
akka.javasdk.testkit.eval.ToolBindings
Which injected stub serves which tool, for cases derived from recordings.
A recorded case carries each tool call production made, with its result. The binding loads that result into the stub that serves the tool in the test:
var bindings = ToolBindings.builder()
.bind("getCustomer", call -> crm.add(call.resultAs(Customer.class)))
.build();
runner.cases(replayed).bindings(bindings).agent(SupportAgent::ask).run();
ExperimentRunner refuses to run a case that names a tool without a binding.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic interfaceLoads the recorded result of one call into its stub. -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether the tool has a binding.static ToolBindings.Builderbuilder()Starts a set of bindings.voidload(Iterable<RecordedCall> calls) Loads each recorded call into the stub bound to its tool, in recorded order.The loader for a tool.static ToolBindingsnone()No bindings.The bound tool names.
-
Method Details
-
builder
Starts a set of bindings. -
none
No bindings. -
binds
Whether the tool has a binding. -
toolNames
The bound tool names. -
loaderFor
The loader for a tool.- Throws:
IllegalArgumentException- when the tool has no binding
-
load
Loads each recorded call into the stub bound to its tool, in recorded order.
-