Match Class
Partial and special matching during template assertions.
Initializer
ts
new Match()
python
Match()
java
new Match()
csharp
new Match()
go
NewMatch()
Methods
absent(): Matcher@staticmethod def absent() -> Matcherpublic static Matcher absent()public static Matcher Absent()func Absent() Matcherstatic#Use this matcher in the place of a field's value, if the field must not be present.
anyValue(): Matcher@staticmethod def any_value() -> Matcherpublic static Matcher anyValue()public static Matcher AnyValue()func AnyValue() Matcherstatic#Matches any non-null value at the target.
arrayEquals(pattern: any[]): Matcher@staticmethod def array_equals(pattern: typing.List[Any]) -> Matcherpublic static Matcher arrayEquals(List<Object> pattern)public static Matcher ArrayEquals(object[] pattern)func ArrayEquals(Pattern *[]interface{}) Matcherstatic#Matches the specified pattern with the array found in the same relative path of the target.
The set of elements (or matchers) must match exactly and in order.
1 parameter
Parameters
patternpatternpatternpatternPattern— the pattern to match.
arrayWith(pattern: any[]): Matcher@staticmethod def array_with(pattern: typing.List[Any]) -> Matcherpublic static Matcher arrayWith(List<Object> pattern)public static Matcher ArrayWith(object[] pattern)func ArrayWith(Pattern *[]interface{}) Matcherstatic#Matches the specified pattern with the array found in the same relative path of the target.
The set of elements (or matchers) must be in the same order as would be found.
1 parameter
Parameters
patternpatternpatternpatternPattern— the pattern to match.
exact(pattern: any): Matcher@staticmethod def exact(pattern: Any) -> Matcherpublic static Matcher exact(Object pattern)public static Matcher Exact(object pattern)func Exact(Pattern interface{}) Matcherstatic#Deep exact matching of the specified pattern to the target.
1 parameter
Parameters
patternpatternpatternpatternPattern— the pattern to match.
not(pattern: any): Matcher@staticmethod def not(pattern: Any) -> Matcherpublic static Matcher not(Object pattern)public static Matcher Not(object pattern)func Not(Pattern interface{}) Matcherstatic#Matches any target which does NOT follow the specified pattern.
1 parameter
Parameters
patternpatternpatternpatternPattern— the pattern to NOT match.
objectEquals(pattern: { [key: string]: any }): Matcher@staticmethod def object_equals(pattern: typing.Mapping[str, Any]) -> Matcherpublic static Matcher objectEquals(Map<String, Object> pattern)public static Matcher ObjectEquals(IDictionary<string, object> pattern)func ObjectEquals(Pattern *map[string]interface{}) Matcherstatic#Matches the specified pattern to an object found in the same relative path of the target.
The keys and their values (or matchers) must match exactly with the target.
1 parameter
Parameters
patternpatternpatternpatternPattern— the pattern to match.
objectLike(pattern: { [key: string]: any }): Matcher@staticmethod def object_like(pattern: typing.Mapping[str, Any]) -> Matcherpublic static Matcher objectLike(Map<String, Object> pattern)public static Matcher ObjectLike(IDictionary<string, object> pattern)func ObjectLike(Pattern *map[string]interface{}) Matcherstatic#Matches the specified pattern to an object found in the same relative path of the target.
The keys and their values (or matchers) must be present in the target but the target can be a superset.
1 parameter
Parameters
patternpatternpatternpatternPattern— the pattern to match.
serializedJson(pattern: any): Matcher@staticmethod def serialized_json(pattern: Any) -> Matcherpublic static Matcher serializedJson(Object pattern)public static Matcher SerializedJson(object pattern)func SerializedJson(Pattern interface{}) Matcherstatic#Matches any string-encoded JSON and applies the specified pattern after parsing it.
1 parameter
Parameters
patternpatternpatternpatternPattern— the pattern to match after parsing the encoded JSON.
stringLikeRegexp(pattern: string): Matcher@staticmethod def string_like_regexp(pattern: str) -> Matcherpublic static Matcher stringLikeRegexp(String pattern)public static Matcher StringLikeRegexp(string pattern)func StringLikeRegexp(Pattern *string) Matcherstatic#Matches targets according to a regular expression.