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.7-jre7.0 pact-jvm-consumer-groovy_2.11 2017-10-03 05:47:06 UTC
3.5.7 pact-jvm-consumer-groovy_2.11 2017-10-03 00:44:33 UTC
3.5.6-jre7.0 pact-jvm-consumer-groovy_2.11 2017-09-28 05:10:20 UTC
3.5.6 pact-jvm-consumer-groovy_2.11 2017-09-27 01:46:11 UTC
3.5.5-jre7.0 pact-jvm-consumer-groovy_2.11 2017-09-14 02:32:37 UTC
3.5.5 pact-jvm-consumer-groovy_2.11 2017-09-11 23:07:17 UTC
3.5.4-jre7.0 pact-jvm-consumer-groovy_2.11 2017-08-19 07:53:15 UTC
3.5.4 pact-jvm-consumer-groovy_2.11 2017-08-18 05:32:58 UTC
2.4.19 pact-jvm-consumer-groovy_2.11 2017-08-16 23:54:26 UTC
3.5.3-jre7.0 pact-jvm-consumer-groovy_2.11 2017-08-10 00:26:07 UTC
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
3.3.9 pact-jvm-consumer-groovy_2.11 2017-05-08 11:26:01 UTC
3.3.8 pact-jvm-consumer-groovy_2.11 2017-04-14 03:51:26 UTC
3.3.7 pact-jvm-consumer-groovy_2.11 2017-03-27 04:33:27 UTC
3.5.0-beta.3 pact-jvm-consumer-groovy_2.11 2017-02-05 05:54:35 UTC
3.3.6 pact-jvm-consumer-groovy_2.11 2017-01-26 06:36:45 UTC