Class HamcrestValidationMatcher

java.lang.Object
org.citrusframework.validation.matcher.hamcrest.HamcrestValidationMatcher
All Implemented Interfaces:
ControlExpressionParser, ValidationMatcher

public class HamcrestValidationMatcher extends Object implements ValidationMatcher, ControlExpressionParser
Since:
2.5
Author:
Christoph Deppisch
  • Constructor Details

    • HamcrestValidationMatcher

      public HamcrestValidationMatcher()
  • Method Details

    • validate

      public void validate(String fieldName, String value, List<String> controlParameters, TestContext context) throws org.citrusframework.exceptions.ValidationException
      Specified by:
      validate in interface ValidationMatcher
      Throws:
      org.citrusframework.exceptions.ValidationException
    • extractControlValues

      public List<String> extractControlValues(String controlExpression, Character delimiter)
      Specified by:
      extractControlValues in interface ControlExpressionParser
    • determineNestedMatcherParameters

      public String[] determineNestedMatcherParameters(String rawExpression)
      Extracts parameters for a matcher from the raw parameter expression. Parameters refer to the contained parameters and matchers (first level), excluding nested ones.

      For example, given the expression:
      "oneOf(greaterThan(5.0), allOf(lessThan(-1.0), greaterThan(-2.0)))"

      The extracted parameters are:
      "greaterThan(5.0)", "allOf(lessThan(-1.0), greaterThan(-2.0))".

      Note that nested container expressions "allOf(lessThan(-1.0), greaterThan(-2.0))" in the second parameter are treated as a single expression. They need to be treated separately in a recursive call to this method, when the parameters for the respective allOf() expression are extracted.

      Parameters:
      rawExpression - the full parameter expression of a container matcher