Wiremock stubs should have the body defined under bodyPatterns, and not body.

This commit is contained in:
Catalin Buleandra
2015-03-21 22:04:38 +01:00
parent 6166ff021b
commit 64fcac070f
4 changed files with 4 additions and 4 deletions

View File

@@ -84,7 +84,7 @@ class DslToWiremockClientConverterSpec extends Specification {
"request":{
"method":"PUT",
"url":"/api/12",
"body": {
"bodyPatterns": {
"equalTo": "[{\\"created_at\\":\\"Sat Jul 26 09:38:57 +0000 2014\\",\\"id\\":492967299297845248,\\"id_str\\":\\"492967299297845248\\",\\"place\\":{\\"attributes\\":{},\\"bounding_box\\":{\\"coordinates\\":[[[-77.119759,38.791645],[-76.909393,38.791645],[-76.909393,38.995548],[-77.119759,38.995548]]],\\"type\\":\\"Polygon\\"},\\"country\\":\\"United States\\",\\"country_code\\":\\"US\\",\\"full_name\\":\\"Washington, DC\\",\\"id\\":\\"01fbe706f872cb32\\",\\"name\\":\\"Washington\\",\\"place_type\\":\\"city\\",\\"url\\":\\"http://api.twitter.com/1/geo/id/01fbe706f872cb32.json\\"},\\"text\\":\\"Gonna see you at Warsaw\\"}]"
},
"headers": {

View File

@@ -39,7 +39,7 @@ class WiremockRequestStubStrategy extends BaseWiremockStubStrategy {
private Map<String, Object> appendBody(ClientRequest clientRequest) {
Object body = clientRequest?.body?.clientValue
return body != null ? [body: [equalTo: parseBody(body)]] : [:]
return body != null ? [bodyPatterns: [equalTo: parseBody(body)]] : [:]
}
private String parseBody(Object responseBodyObject) {

View File

@@ -140,7 +140,7 @@ class WiremockGroovyDslSpec extends Specification {
"request": {
"method": "GET",
"urlPattern": "/[0-9]{2}",
"body": {
"bodyPatterns": {
"equalTo":"{\\"name\\":\\"Jan\\"}"
}
},

View File

@@ -51,7 +51,7 @@ class BasicFunctionalSpec extends IntegrationSpec {
}
},
"url": "/api/12",
"body": {
"bodyPatterns": {
"equalTo": "[{\\"text\\":\\"Gonna see you at Warsaw\\"}]"
}
},