Adding an option to validate children nodes in an array (#219)
without this change it's impossible to assert with response matchers all elements of an array with this change we're using AssertJs conditions in case the pattern contains [*] fixes #217
This commit is contained in:
committed by
GitHub
parent
8449382110
commit
ab7fe13aac
@@ -39,4 +39,11 @@ enum MatchingType {
|
||||
* provided regex
|
||||
*/
|
||||
REGEX
|
||||
|
||||
static boolean regexRelated(MatchingType type) {
|
||||
if (type == EQUALITY || type == TYPE ) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.springframework.cloud.contract.spec.internal
|
||||
|
||||
import spock.lang.Specification
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
class MatchingTypeSpec extends Specification {
|
||||
def "should return [#expected] for type [#type]"() {
|
||||
expect:
|
||||
MatchingType.regexRelated(type) == expected
|
||||
where:
|
||||
type | expected
|
||||
MatchingType.EQUALITY | false
|
||||
MatchingType.TYPE | false
|
||||
MatchingType.REGEX | true
|
||||
MatchingType.DATE | true
|
||||
MatchingType.TIME | true
|
||||
MatchingType.TIMESTAMP | true
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user