Class TolerantArgumentMatcher

java.lang.Object
dev.dokimos.core.evaluators.agents.TolerantArgumentMatcher
All Implemented Interfaces:
ArgumentMatcher

public final class TolerantArgumentMatcher extends Object implements ArgumentMatcher
Default ArgumentMatcher that compares arguments structurally with a few deliberate tolerances.

Value comparison rules:

Key-set handling follows the configured ArgMatchMode.

 ArgumentMatcher matcher = TolerantArgumentMatcher.builder()
         .mode(ArgMatchMode.SUBSET)   // only expected keys must be present and correct
         .trimStrings(true)
         .build();
 
  • Method Details

    • builder

      public static TolerantArgumentMatcher.Builder builder()
      Creates a new builder for constructing the matcher.
      Returns:
      a new builder
    • matches

      public boolean matches(Map<String,Object> expected, Map<String,Object> actual)
      Description copied from interface: ArgumentMatcher
      Determines whether the actual arguments match the expected arguments.
      Specified by:
      matches in interface ArgumentMatcher
      Parameters:
      expected - the expected arguments
      actual - the actual arguments produced by the agent
      Returns:
      true if the arguments match under this matcher's policy