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
-
Field Summary
Fields inherited from interface org.citrusframework.validation.matcher.ControlExpressionParser
DEFAULT_DELIMITERFields inherited from interface org.citrusframework.validation.matcher.ValidationMatcher
logger, matcher, RESOURCE_PATH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionString[]determineNestedMatcherParameters(String rawExpression) Extracts parameters for a matcher from the raw parameter expression.extractControlValues(String controlExpression, Character delimiter) void
-
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:
validatein interfaceValidationMatcher- Throws:
org.citrusframework.exceptions.ValidationException
-
extractControlValues
- Specified by:
extractControlValuesin interfaceControlExpressionParser
-
determineNestedMatcherParameters
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
-