Class TolerantArgumentMatcher
java.lang.Object
dev.dokimos.core.evaluators.agents.TolerantArgumentMatcher
- All Implemented Interfaces:
ArgumentMatcher
Default
ArgumentMatcher that compares arguments structurally with a few
deliberate tolerances.
Value comparison rules:
- Numbers are compared by numeric value, so
1,1.0and1Lare equal. This is always on, because exactMap.equalstreating1and1.0as different is a JSON-widening artifact, not intended behavior. - Strings are compared exactly by default.
TolerantArgumentMatcher.Builder.trimStrings(boolean)andTolerantArgumentMatcher.Builder.caseInsensitive(boolean)relax this, but both are off by default so existing pass/fail outcomes are never silently changed. - Maps and lists are compared recursively using the same rules.
ArgMatchMode.
ArgumentMatcher matcher = TolerantArgumentMatcher.builder()
.mode(ArgMatchMode.SUBSET) // only expected keys must be present and correct
.trimStrings(true)
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder for constructing the matcher. -
Method Summary
-
Method Details
-
builder
Creates a new builder for constructing the matcher.- Returns:
- a new builder
-
matches
Description copied from interface:ArgumentMatcherDetermines whether the actual arguments match the expected arguments.- Specified by:
matchesin interfaceArgumentMatcher- Parameters:
expected- the expected argumentsactual- the actual arguments produced by the agent- Returns:
trueif the arguments match under this matcher's policy
-