Merge branch '2.0.x'

This commit is contained in:
Marcin Grzejszczak
2018-10-23 20:25:27 +02:00
3 changed files with 16 additions and 2 deletions

View File

@@ -101,6 +101,10 @@ class Request extends Common {
this.urlPath = new UrlPath(path)
}
void urlPath(GString path) {
this.urlPath = new UrlPath(path)
}
void urlPath(DslProperty path) {
this.urlPath = new UrlPath(path)
}
@@ -111,6 +115,12 @@ class Request extends Common {
closure()
}
void urlPath(GString path, @DelegatesTo(UrlPath) Closure closure) {
this.urlPath = new UrlPath(path)
closure.delegate = urlPath
closure()
}
void urlPath(DslProperty path, @DelegatesTo(UrlPath) Closure closure) {
this.urlPath = new UrlPath(path)
closure.delegate = urlPath

View File

@@ -35,6 +35,10 @@ class UrlPath extends Url {
super(path)
}
UrlPath(GString path) {
super(path)
}
UrlPath(DslProperty path) {
super(path)
}

View File

@@ -641,7 +641,7 @@ class SpringTestMethodBodyBuildersSpec extends Specification implements WireMock
Contract contractDsl = Contract.make {
request {
method 'GET'
urlPath('/users') {
urlPath("/users/${value(regex("1"))}") {
queryParameters {
parameter 'limit': $(consumer(equalTo('20')), producer(equalTo('10')))
parameter 'offset': $(consumer(containing("20")), producer(equalTo('20')))
@@ -680,7 +680,7 @@ class SpringTestMethodBodyBuildersSpec extends Specification implements WireMock
test.contains('''.queryParam("age","99")''')
test.contains('''.queryParam("name","Denis.Stepanov")''')
test.contains('''.queryParam("email","bob@email.com")''')
test.contains('''.get("/users")''')
test.contains('''.get("/users/1")''')
test.contains('assertThatJson(parsedJson).field("[\'property1\']").isEqualTo("a")')
test.contains('assertThatJson(parsedJson).field("[\'property2\']").isEqualTo("b")')
and: