Versions of artifact au.com.dius:pact-jvm-consumer-groovy_2.11

pact-jvm-consumer-groovy_2.11

pact-jvm-consumer-groovy ========================= Groovy DSL for Pact JVM ## Dependency The library is available on maven central using: * group-id = `au.com.dius` * artifact-id = `pact-jvm-consumer-groovy_2.11` * version-id = `3.5.x` ## Usage Add the `pact-jvm-consumer-groovy` library to your test class path. This provides a `PactBuilder` class for you to use to define your pacts. For a full example, have a look at the example JUnit `ExampleGroovyConsumerPactTest`. If you are using gradle for your build, add it to your `build.gradle`: dependencies { testCompile 'au.com.dius:pact-jvm-consumer-groovy_2.11:3.5.0' } Then create an instance of the `PactBuilder` in your test. ```groovy import au.com.dius.pact.consumer.PactVerificationResult import au.com.dius.pact.consumer.groovy.PactBuilder import groovyx.net.http.RESTClient import org.junit.Test class AliceServiceConsumerPactTest { @Test void "A service consumer side of a pact goes a little something like this"() { def alice_service = new PactBuilder() // Create a new PactBuilder alice_service { serviceConsumer "Consumer" // Define the service consumer by name hasPactWith "Alice Service" // Define the service provider that it has a pact with port 1234 // The port number for the service. It is optional, leave it out to // to use a random one given('there is some good mallory') // defines a provider state. It is optional. uponReceiving('a retrieve Mallory request') // upon_receiving starts a new interaction withAttributes(method: 'get', path: '/mallory') // define the request, a GET request to '/mallory' willRespondWith( // define the response we want returned status: 200, headers: ['Content-Type': 'text/html'], body: '"That is some good Mallory."' ) } // Execute the run method to have the mock server run. // It takes a closure to execute your requests and returns a PactVerificationResult. PactVerificationResult result = alice_service.runTest { def client = new RESTClient('http://localhost:1234/') def alice_response = client.get(path: '/mallory') assert alice_response.status == 200 assert alice_response.contentType == 'text/html' def data = alice_response.data.text() assert data == '"That is some good Mallory."' } assert result == PactVerificationResult.Ok.INSTANCE // This means it is all good } } ``` After running this test, the following pact file is produced: { "provider" : { "name" : "Alice Service" }, "consumer" : { "name" : "Consumer" }, "interactions" : [ { "provider_state" : "there is some good mallory", "description" : "a retrieve Mallory request", "request" : { "method" : "get", "path" : "/mallory", "requestMatchers" : { } }, "response" : { "status" : 200, "headers" : { "Content-Type" : "text/html" }, "body" : "That is some good Mallory.", "responseMatchers" : { } } } ] } ### DSL Methods #### serviceConsumer(String co

Artifact Version Name Latest uploaded at
3.5.3 pact-jvm-consumer-groovy_2.11 2017-08-06 07:53:00 UTC
3.5.2 pact-jvm-consumer-groovy_2.11 2017-07-12 01:07:28 UTC
3.5.2-jre7.0 pact-jvm-consumer-groovy_2.11 2017-07-12 00:33:51 UTC
3.5.1 pact-jvm-consumer-groovy_2.11 2017-07-09 08:13:39 UTC
3.5.1-jre7.1 pact-jvm-consumer-groovy_2.11 2017-07-09 06:52:28 UTC
3.5.0-jre7.1 pact-jvm-consumer-groovy_2.11 2017-06-24 13:12:55 UTC
3.5.0-jre7 pact-jvm-consumer-groovy_2.11 2017-06-24 11:23:04 UTC
3.5.0 pact-jvm-consumer-groovy_2.11 2017-06-24 08:07:50 UTC
3.5.0-rc.3 pact-jvm-consumer-groovy_2.11 2017-06-20 23:37:45 UTC
3.5.0-rc.2 pact-jvm-consumer-groovy_2.11 2017-06-11 07:07:01 UTC
3.4.1 pact-jvm-consumer-groovy_2.11 2017-06-11 01:59:21 UTC
3.5.0-rc.1 pact-jvm-consumer-groovy_2.11 2017-05-25 03:39:08 UTC
3.4.0 pact-jvm-consumer-groovy_2.11 2017-05-18 05:35:09 UTC
3.3.10 pact-jvm-consumer-groovy_2.11 2017-05-18 03:58:57 UTC
3.5.0-beta.4 pact-jvm-consumer-groovy_2.11 2017-05-14 11:45:52 UTC
2.4.18 pact-jvm-consumer-groovy_2.11 2016-12-30 01:39:31 UTC
2.5.0-beta.0 pact-jvm-consumer-groovy_2.11 2016-10-22 12:52:22 UTC
2.4.17 pact-jvm-consumer-groovy_2.11 2016-10-22 06:53:26 UTC
2.4.16 pact-jvm-consumer-groovy_2.11 2016-10-01 21:30:16 UTC
2.4.15 pact-jvm-consumer-groovy_2.11 2016-08-23 12:46:55 UTC
2.4.14 pact-jvm-consumer-groovy_2.11 2016-08-07 03:32:26 UTC
3.3.0-beta.0 pact-jvm-consumer-groovy_2.11 2016-07-31 09:00:17 UTC
2.4.13 pact-jvm-consumer-groovy_2.11 2016-07-31 05:02:14 UTC
2.4.12 pact-jvm-consumer-groovy_2.11 2016-07-15 02:50:32 UTC
2.4.11 pact-jvm-consumer-groovy_2.11 2016-07-06 05:07:22 UTC
2.4.10 pact-jvm-consumer-groovy_2.11 2016-06-17 23:08:36 UTC
2.2.15 pact-jvm-consumer-groovy_2.11 2015-09-17 10:06:15 UTC
2.2.14 pact-jvm-consumer-groovy_2.11 2015-09-07 10:07:19 UTC
2.2.13 pact-jvm-consumer-groovy_2.11 2015-08-29 05:21:17 UTC
2.2.12 pact-jvm-consumer-groovy_2.11 2015-08-09 07:14:58 UTC