Fixed the generation of values for regexs

This commit is contained in:
Marcin Grzejszczak
2016-07-21 14:35:59 +02:00
parent 5299a1767d
commit 7496101b1d
8 changed files with 61 additions and 24 deletions

View File

@@ -6,24 +6,26 @@ org.springframework.cloud.contract.spec.Contract.make {
url '/fraudcheck'
body("""
{
"clientId":"${value(consumer(regex('[0-9]{10}')), producer('1234567890'))}",
"clientId":"${value(consumer(regex('[0-9]{10}')))}",
"loanAmount":99999}
"""
)
headers {
header('Content-Type', 'application/vnd.fraud.v1+json')
}
}
response {
status 200
body( """{
"fraudCheckStatus": "${value(consumer('FRAUD'), producer(regex('[A-Z]{5}')))}",
"rejectionReason": "Amount too high"
}""")
"fraudCheckStatus": "FRAUD",
"rejectionReason": "Amount too high"
}""")
headers {
header('Content-Type': value(producer(regex('application/vnd.fraud.v1.json.*')), consumer('application/vnd.fraud.v1+json')))
}
header('Content-Type': value(
producer(regex('application/vnd.fraud.v1.json.*')),
consumer('application/vnd.fraud.v1+json'))
)
}
}
}

View File

@@ -23,7 +23,10 @@ org.springframework.cloud.contract.spec.Contract.make {
rejectionReason: $(consumer(null), producer(execute('assertThatRejectionReasonIsNull($it)')))
)
headers {
header('Content-Type': value(producer(regex('application/vnd.fraud.v1.json.*')), consumer('application/vnd.fraud.v1+json')))
header('Content-Type': value(
producer(regex('application/vnd.fraud.v1.json.*')),
consumer('application/vnd.fraud.v1+json'))
)
}
}