Created
May 13, 2015 21:57
-
-
Save marcingrzejszczak/51fcc590da216fac1e04 to your computer and use it in GitHub Desktop.
Dwa sample jsony
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
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