@@ -23,67 +23,67 @@ import spock.util.concurrent.AsyncConditions
2323
2424class DefaultMockServerAnyMethodTest extends Specification {
2525
26- @Shared
27- static def vertx = Vertx . vertx()
26+ @Shared
27+ static def vertx = Vertx . vertx()
2828
29- DefaultMockServer server
29+ DefaultMockServer server
3030
31- WebClient client
31+ WebClient client
3232
33- def setup () {
34- server = new DefaultMockServer ()
35- server. start()
36- client = WebClient . create(vertx)
37- }
33+ def setup () {
34+ server = new DefaultMockServer ()
35+ server. start()
36+ client = WebClient . create(vertx)
37+ }
3838
39- def cleanup () {
40- server. shutdown()
41- client. close()
42- }
39+ def cleanup () {
40+ server. shutdown()
41+ client. close()
42+ }
4343
44- def cleanupSpec () {
45- vertx. close()
46- }
44+ def cleanupSpec () {
45+ vertx. close()
46+ }
4747
48- def " when setting an expectation for ANY should respond to POST" () {
49- given : " An expectation with any"
50- server. expect(). any(). withPath(" /api/v1/resource" ). andReturn(200 , " OK" ). always()
51- and : " A POST request"
52- def req1 = client. post(server. port, server. getHostName(), " /api/v1/resource" )
53- .send()
54- and : " An instance of AsyncConditions"
55- def async = new AsyncConditions (1 )
48+ def " when setting an expectation for ANY should respond to POST" () {
49+ given : " An expectation with any"
50+ server. expect(). any(). withPath(" /api/v1/resource" ). andReturn(200 , " OK" ). always()
51+ and : " A POST request"
52+ def req1 = client. post(server. port, server. getHostName(), " /api/v1/resource" )
53+ .send()
54+ and : " An instance of AsyncConditions"
55+ def async = new AsyncConditions (1 )
5656
57- when : " The request is sent and completed"
58- req1. onComplete { isr ->
59- async. evaluate {
60- assert req1. result(). statusCode() == 200
61- assert req1. result(). body(). toString() == " OK"
62- }
63- }
57+ when : " The request is sent and completed"
58+ req1. onComplete { isr ->
59+ async. evaluate {
60+ assert req1. result(). statusCode() == 200
61+ assert req1. result(). body(). toString() == " OK"
62+ }
63+ }
6464
65- then : " Expect the result to be completed in the specified time"
66- async. await(10 )
67- }
65+ then : " Expect the result to be completed in the specified time"
66+ async. await(10 )
67+ }
6868
69- def " when setting an expectation for ANY should respond to PUT" () {
70- given : " An expectation with any"
71- server. expect(). any(). withPath(" /api/v1/resource" ). andReturn(200 , " OK" ). always()
72- and : " A PUT request"
73- def req1 = client. put(server. port, server. getHostName(), " /api/v1/resource" )
74- .send()
75- and : " An instance of AsyncConditions"
76- def async = new AsyncConditions (1 )
69+ def " when setting an expectation for ANY should respond to PUT" () {
70+ given : " An expectation with any"
71+ server. expect(). any(). withPath(" /api/v1/resource" ). andReturn(200 , " OK" ). always()
72+ and : " A PUT request"
73+ def req1 = client. put(server. port, server. getHostName(), " /api/v1/resource" )
74+ .send()
75+ and : " An instance of AsyncConditions"
76+ def async = new AsyncConditions (1 )
7777
78- when : " The request is sent and completed"
79- req1. onComplete { isr ->
80- async. evaluate {
81- assert req1. result(). statusCode() == 200
82- assert req1. result(). body(). toString() == " OK"
83- }
84- }
78+ when : " The request is sent and completed"
79+ req1. onComplete { isr ->
80+ async. evaluate {
81+ assert req1. result(). statusCode() == 200
82+ assert req1. result(). body(). toString() == " OK"
83+ }
84+ }
8585
86- then : " Expect the result to be completed in the specified time"
87- async. await(10 )
88- }
86+ then : " Expect the result to be completed in the specified time"
87+ async. await(10 )
88+ }
8989}
0 commit comments