Package org.citrusframework.validation
Class ValidationUtils
java.lang.Object
org.citrusframework.validation.ValidationUtils
Utility class provides helper methods for validation work in Citrus.
- Since:
- 1.3
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildValueMismatchErrorMessage(String baseMessage, Object controlValue, Object actualValue) Constructs proper error message with expected value and actual value.static StringbuildValueToBeInCollectionErrorMessage(String baseMessage, Object controlValue, Collection<?> actualValues) Constructs proper error message for a value that should be in a collection.static voidvalidateValues(Object actualValue, Object expectedValue, String pathExpression, TestContext context) Validates actual against expected value of element
-
Method Details
-
validateValues
public static void validateValues(Object actualValue, Object expectedValue, String pathExpression, TestContext context) throws ValidationException Validates actual against expected value of element- Parameters:
actualValue-expectedValue-pathExpression-context-- Throws:
ValidationException- if validation fails
-
buildValueMismatchErrorMessage
public static String buildValueMismatchErrorMessage(String baseMessage, Object controlValue, Object actualValue) Constructs proper error message with expected value and actual value.- Parameters:
baseMessage- the base error message.controlValue- the expected value.actualValue- the actual value.- Returns:
-
buildValueToBeInCollectionErrorMessage
public static String buildValueToBeInCollectionErrorMessage(String baseMessage, Object controlValue, Collection<?> actualValues) Constructs proper error message for a value that should be in a collection.- Parameters:
baseMessage- the base error message.controlValue- the expected value.actualValues- where the controlValue should be present in.- Returns:
-