Fix sample
This commit is contained in:
@@ -21,10 +21,10 @@ import org.springframework.cloud.contract.spec.internal.HttpStatus
|
||||
contract {
|
||||
request {
|
||||
url = url("/goodbye")
|
||||
method = method(HttpMethods.HttpMethod.GET)
|
||||
method = GET
|
||||
}
|
||||
response {
|
||||
status = code(HttpStatus.OK())
|
||||
status = OK
|
||||
body = body("Goodbye World!")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,14 +22,14 @@ import org.springframework.cloud.contract.spec.internal.HttpMethods
|
||||
contract {
|
||||
request {
|
||||
url = url("/1")
|
||||
method = method(HttpMethods.PUT())
|
||||
method = PUT
|
||||
headers {
|
||||
contentType(applicationOctetStream())
|
||||
}
|
||||
body = bodyFromFileAsBytes("request.pdf")
|
||||
}
|
||||
response {
|
||||
status = code(200)
|
||||
status = OK
|
||||
body = bodyFromFileAsBytes("response.pdf")
|
||||
headers {
|
||||
contentType(applicationOctetStream())
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.springframework.cloud.contract.spec.internal.HttpStatus
|
||||
|
||||
contract {
|
||||
request { // (1)
|
||||
method = method("PUT") // (2)
|
||||
method = PUT // (2)
|
||||
url = url("/fraudcheck") // (3)
|
||||
body = body(// (4)
|
||||
"client.id" to value(regex("[0-9]{10}")),
|
||||
@@ -31,7 +31,7 @@ contract {
|
||||
}
|
||||
}
|
||||
response { // (6)
|
||||
status = code(HttpStatus.OK()) // (7)
|
||||
status = OK // (7)
|
||||
body = body( // (8)
|
||||
"fraudCheckStatus" to "FRAUD",
|
||||
"rejection.reason" to "Amount too high")
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.springframework.cloud.contract.spec.internal.HttpStatus
|
||||
|
||||
contract {
|
||||
request {
|
||||
method = method("PUT")
|
||||
method = PUT
|
||||
url = url("/fraudcheck")
|
||||
body = body(
|
||||
"client.id" to value(consumer(regex("[0-9]{10}")), producer("1234567890")),
|
||||
@@ -31,7 +31,7 @@ contract {
|
||||
}
|
||||
}
|
||||
response {
|
||||
status = code(HttpStatus.OK())
|
||||
status = OK
|
||||
body = body(
|
||||
"fraudCheckStatus" to "OK",
|
||||
"rejection.reason" to value(consumer(null), producer(execute("assertThatRejectionReasonIsNull(\$it)")))
|
||||
|
||||
@@ -24,11 +24,11 @@ listOf(
|
||||
contract {
|
||||
name = "should count all frauds"
|
||||
request {
|
||||
method = method(HttpMethods.GET())
|
||||
method = GET
|
||||
url = url("/frauds")
|
||||
}
|
||||
response {
|
||||
status = code(HttpStatus.OK())
|
||||
status = OK
|
||||
body = body(
|
||||
"count" to value(regex("[2-9][0-9][0-9]"))
|
||||
)
|
||||
@@ -39,11 +39,11 @@ listOf(
|
||||
},
|
||||
contract {
|
||||
request {
|
||||
method = method(HttpMethods.GET())
|
||||
method = GET
|
||||
url = url("/drunks")
|
||||
}
|
||||
response {
|
||||
status = code(HttpStatus.OK())
|
||||
status = OK
|
||||
body = body(
|
||||
"count" to 100
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.springframework.cloud.contract.spec.internal.HttpMethods
|
||||
|
||||
contract {
|
||||
request {
|
||||
method = method(HttpMethods.HttpMethod.GET)
|
||||
method = GET
|
||||
url = url("/frauds/name")
|
||||
cookies {
|
||||
cookie("name", "foo")
|
||||
@@ -29,7 +29,7 @@ contract {
|
||||
}
|
||||
}
|
||||
response {
|
||||
status = code(200)
|
||||
status = OK
|
||||
body = body("foo bar")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ contract {
|
||||
// highest priority
|
||||
priority = 1
|
||||
request {
|
||||
method = method(HttpMethods.HttpMethod.PUT)
|
||||
method = PUT
|
||||
url = url("/frauds/name")
|
||||
body = body("name" to "fraud")
|
||||
headers {
|
||||
@@ -32,7 +32,7 @@ contract {
|
||||
}
|
||||
}
|
||||
response {
|
||||
status = code(HttpStatus.OK())
|
||||
status = OK
|
||||
// TODO
|
||||
// body = body("result" to "Sorry ${fromRequest().body("$.name")} but you're a fraud")
|
||||
// headers {
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.cloud.contract.spec.internal.HttpStatus
|
||||
|
||||
contract {
|
||||
request {
|
||||
method = method(HttpMethods.HttpMethod.PUT)
|
||||
method = PUT
|
||||
url = url("/frauds/name")
|
||||
body = body("name" to `$`(anyAlphaUnicode()))
|
||||
headers {
|
||||
@@ -30,7 +30,7 @@ contract {
|
||||
}
|
||||
}
|
||||
response {
|
||||
status = code(HttpStatus.OK())
|
||||
status = OK
|
||||
// TODO
|
||||
// body("result" to "Don't worry ${fromRequest().body("$.name")} you're not a fraud")
|
||||
// headers {
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.springframework.cloud.contract.spec.internal.HttpMethods
|
||||
|
||||
contract {
|
||||
request {
|
||||
method = method("POST")
|
||||
method = POST
|
||||
url = url("/tests")
|
||||
multipart = multipart(mapOf(
|
||||
"file1" to named(
|
||||
@@ -40,7 +40,7 @@ contract {
|
||||
}
|
||||
}
|
||||
response {
|
||||
status = code(200)
|
||||
status = OK
|
||||
body = body("status" to "ok")
|
||||
headers {
|
||||
contentType("application/json")
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.springframework.cloud.contract.spec.internal.HttpMethods
|
||||
|
||||
contract {
|
||||
request {
|
||||
method = method("POST")
|
||||
method = POST
|
||||
url = url("/tests")
|
||||
multipart = multipart(mapOf(
|
||||
"file1" to named(
|
||||
@@ -40,7 +40,7 @@ contract {
|
||||
}
|
||||
}
|
||||
response {
|
||||
status = code(200)
|
||||
status = OK
|
||||
body = body("status" to "ok")
|
||||
headers {
|
||||
contentType("application/json")
|
||||
|
||||
Reference in New Issue
Block a user