From c12eeb7a07f78626613fde41c87213e0309ab64a Mon Sep 17 00:00:00 2001 From: Dominik Adam Przybysz Date: Sun, 1 Feb 2015 20:34:44 +0100 Subject: [PATCH] Extract Method enum to separate file Change-Id: Ibb35bb26ca94689fc400cd510565c86e3d61087c --- README.md | 2 +- .../mockserver/client/AddMockRequestData.groovy | 12 +----------- .../groovy/pl/touk/mockserver/client/Method.groovy | 12 ++++++++++++ .../tests/MockServerIntegrationTest.groovy | 14 +++++++------- 4 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 mockserver-client/src/main/groovy/pl/touk/mockserver/client/Method.groovy diff --git a/README.md b/README.md index 550d434..cb873b3 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ or via sending POST request to localhost:/serverControl ... ... ... - ,,, + ... ``` diff --git a/mockserver-client/src/main/groovy/pl/touk/mockserver/client/AddMockRequestData.groovy b/mockserver-client/src/main/groovy/pl/touk/mockserver/client/AddMockRequestData.groovy index 4e3dfbe..6da9a6e 100644 --- a/mockserver-client/src/main/groovy/pl/touk/mockserver/client/AddMockRequestData.groovy +++ b/mockserver-client/src/main/groovy/pl/touk/mockserver/client/AddMockRequestData.groovy @@ -28,15 +28,5 @@ class AddMockRequestData { void setResponseHeaders(String responseHeaders) { this.responseHeaders = StringEscapeUtils.escapeXml11(responseHeaders) } - - enum Method { - POST, - GET, - DELETE, - PUT, - TRACE, - HEAD, - OPTIONS, - PATCH - } } + diff --git a/mockserver-client/src/main/groovy/pl/touk/mockserver/client/Method.groovy b/mockserver-client/src/main/groovy/pl/touk/mockserver/client/Method.groovy new file mode 100644 index 0000000..82aefea --- /dev/null +++ b/mockserver-client/src/main/groovy/pl/touk/mockserver/client/Method.groovy @@ -0,0 +1,12 @@ +package pl.touk.mockserver.client + +enum Method { + POST, + GET, + DELETE, + PUT, + TRACE, + HEAD, + OPTIONS, + PATCH +} diff --git a/mockserver-tests/src/test/groovy/pl/touk/mockserver/tests/MockServerIntegrationTest.groovy b/mockserver-tests/src/test/groovy/pl/touk/mockserver/tests/MockServerIntegrationTest.groovy index aaf0e8a..9640ef8 100644 --- a/mockserver-tests/src/test/groovy/pl/touk/mockserver/tests/MockServerIntegrationTest.groovy +++ b/mockserver-tests/src/test/groovy/pl/touk/mockserver/tests/MockServerIntegrationTest.groovy @@ -298,7 +298,7 @@ class MockServerIntegrationTest extends Specification { path: 'testEndpoint', port: 9999, response: '''{_ -> ""}''', - method: AddMockRequestData.Method.GET + method: Method.GET )) HttpGet restGet = new HttpGet('http://localhost:9999/testEndpoint') when: @@ -321,7 +321,7 @@ class MockServerIntegrationTest extends Specification { path: 'testEndpoint', port: 9999, response: '''{_ -> ""}''', - method: AddMockRequestData.Method.TRACE + method: Method.TRACE )) HttpTrace restTrace = new HttpTrace('http://localhost:9999/testEndpoint') when: @@ -343,7 +343,7 @@ class MockServerIntegrationTest extends Specification { name: 'testRest2', path: 'testEndpoint', port: 9999, - method: AddMockRequestData.Method.HEAD + method: Method.HEAD )) HttpHead restHead = new HttpHead('http://localhost:9999/testEndpoint') when: @@ -365,7 +365,7 @@ class MockServerIntegrationTest extends Specification { name: 'testRest2', path: 'testEndpoint', port: 9999, - method: AddMockRequestData.Method.OPTIONS + method: Method.OPTIONS )) HttpOptions restOptions = new HttpOptions('http://localhost:9999/testEndpoint') when: @@ -389,7 +389,7 @@ class MockServerIntegrationTest extends Specification { port: 9999, predicate: '''{req -> req.xml.name() == 'request1'}''', response: '''{_ -> ""}''', - method: AddMockRequestData.Method.PUT + method: Method.PUT )) HttpPut request = new HttpPut('http://localhost:9999/test1') request.entity = new StringEntity('', ContentType.create("text/xml", "UTF-8")) @@ -413,7 +413,7 @@ class MockServerIntegrationTest extends Specification { path: 'test1', port: 9999, response: '''{_ -> ""}''', - method: AddMockRequestData.Method.DELETE + method: Method.DELETE )) HttpDelete request = new HttpDelete('http://localhost:9999/test1') when: @@ -437,7 +437,7 @@ class MockServerIntegrationTest extends Specification { port: 9999, predicate: '''{req -> req.xml.name() == 'request1'}''', response: '''{_ -> ""}''', - method: AddMockRequestData.Method.PATCH + method: Method.PATCH )) HttpPatch request = new HttpPatch('http://localhost:9999/test1') request.entity = new StringEntity('', ContentType.create("text/xml", "UTF-8"))