Skip to content

Instantly share code, notes, and snippets.

@marcingrzejszczak
Created May 13, 2015 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcingrzejszczak/51fcc590da216fac1e04 to your computer and use it in GitHub Desktop.
Save marcingrzejszczak/51fcc590da216fac1e04 to your computer and use it in GitHub Desktop.
Dwa sample jsony
```
io.codearte.accurest.dsl.GroovyDsl.make {
request {
method """PUT"""
url """/fraudcheck"""
body("""
{
"clientPesel":"${value(client(regex('[0-9]{10}')), server('1234567890'))}",
"loanAmount":99999}
"""
)
headers {
header("""Content-Type""", """application/vnd.fraud.v1+json""")
}
}
response {
status 200
body( """{
"fraudCheckStatus": "${value(client('FRAUD'), server(regex('[A-Z]{5}')))}",
"rejectionReason": "Amount too high"
}""")
headers {
header('Content-Type': 'application/vnd.fraud.v1+json')
}
}
}
```
```
io.codearte.accurest.dsl.GroovyDsl.make {
request {
method 'PUT'
url '/fraudcheck'
body("""
{
"clientPesel":"${value(client(regex('[0-9]{10}')), server('1234567890'))}",
"loanAmount":123.123
}
"""
)
headers {
header('Content-Type', 'application/vnd.fraud.v1+json')
}
}
response {
status 200
body(
fraudCheckStatus: "OK",
rejectionReason: $(client(null), server(execute('assertThatRejectionReasonIsNull($it)')))
)
headers {
header('Content-Type': 'application/vnd.fraud.v1+json')
}
}
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment