Class MatchesTextCondition
java.lang.Object
uk.org.webcompere.modelassert.json.condition.MatchesTextCondition
- All Implemented Interfaces:
Condition
A text node matches a regular expression
-
Constructor Summary
ConstructorsConstructorDescriptionMatchesTextCondition(String conditionName, Predicate<String> predicate) Create a custom text conditionMatchesTextCondition(Pattern pattern) Create a condition which requires the text to meet the patternMatchesTextCondition(Pattern pattern, String conditionName) Create a condition which requires the text to meet the pattern -
Method Summary
Modifier and TypeMethodDescriptiondescribe()Describe the conditiontest(com.fasterxml.jackson.databind.JsonNode json) Execute the test of the conditionstatic MatchesTextConditiontextContains(String contains) Build a text contains conditionstatic MatchesTextConditiontextMatches(Pattern pattern) Build a matcher conditionstatic MatchesTextConditiontextStartsWith(String substring) Build a text starts with condition
-
Constructor Details
-
MatchesTextCondition
Create a condition which requires the text to meet the pattern- Parameters:
pattern- regex that must match
-
MatchesTextCondition
Create a condition which requires the text to meet the pattern- Parameters:
pattern- regex that must matchconditionName- the name of the condition for the description
-
MatchesTextCondition
Create a custom text condition- Parameters:
conditionName- the name of the conditionpredicate- the predicate to meet on the text
-
-
Method Details
-
textContains
Build a text contains condition- Parameters:
contains- the substring to search- Returns:
- a new
MatchesTextConditioncondition
-
textStartsWith
Build a text starts with condition- Parameters:
substring- the substring to search- Returns:
- a new
MatchesTextConditioncondition
-
textMatches
Build a matcher condition- Parameters:
pattern- the pattern to match- Returns:
- a new
MatchesTextConditioncondition
-
test
Execute the test of the condition -
describe
Describe the condition
-