Versions of artifact au.com.dius:pact-jvm-provider-junit_2.11

pact-jvm-provider-junit_2.11

# Pact junit runner ## Overview Library provides ability to play contract tests against a provider service in JUnit fashionable way. Supports: - Out-of-the-box convenient ways to load pacts - Easy way to change assertion strategy - **org.junit.BeforeClass**, **org.junit.AfterClass** and **org.junit.ClassRule** JUnit annotations, that will be run once - before/after whole contract test suite. - **org.junit.Before**, **org.junit.After** and **org.junit.Rule** JUnit annotations, that will be run before/after each test of an interaction. - **au.com.dius.pact.provider.junit.State** custom annotation - before each interaction that requires a state change, all methods annotated by `@State` with appropriate the state listed will be invoked. These methods must either take no parameters or a single Map parameter. ## Example of HTTP test ```java @RunWith(PactRunner.class) // Say JUnit to run tests with custom Runner @Provider("myAwesomeService") // Set up name of tested provider @PactFolder("pacts") // Point where to find pacts (See also section Pacts source in documentation) public class ContractTest { // NOTE: this is just an example of embedded service that listens to requests, you should start here real service @ClassRule //Rule will be applied once: before/after whole contract test suite public static final ClientDriverRule embeddedService = new ClientDriverRule(8332); @BeforeClass //Method will be run once: before whole contract test suite public static void setUpService() { //Run DB, create schema //Run service //... } @Before //Method will be run before each test of interaction public void before() { // Rest data // Mock dependent service responses // ... embeddedService.addExpectation( onRequestTo("/data"), giveEmptyResponse() ); } @State("default", "no-data") // Method will be run before testing interactions that require "default" or "no-data" state public void toDefaultState() { // Prepare service before interaction that require "default" state // ... System.out.println("Now service in default state"); } @State("with-data") // Method will be run before testing interactions that require "with-data" state public void toStateWithData(Map data) { // Prepare service before interaction that require "with-data" state. The provider state data will be passed // in the data parameter // ... System.out.println("Now service in state using data " + data); } @TestTarget // Annotation denotes Target that will be used for tests public final Target target = new HttpTarget(8332); // Out-of-the-box implementation of Target (for more information take a look at Test Target section) } ``` ## Example of AMQP Message test ```java @RunWith(PactRunner.class) // Say JUnit to run tests with custom Runner @Provider("myAwesomeService") // Set up name of tested provider @PactBroker(host="pactbroker", port = "80") public class ConfirmationKafkaContractTest { @TestTarget // Annotation denotes Target that will be used for tests public final Target target = new AmqpTarget(); // Out-of-the-box implementation of Target (for more information take a look at Test Target section) @BeforeClass //Method will be run once: before whole contract test suite public static void setUpService() { //Run DB, create schema //Run service //... } @Before //Method will be run before each test of interaction public void before() {

Artifact Version Name Latest uploaded at
3.3.5 pact-jvm-provider-junit_2.11 2017-01-14 06:51:56 UTC
3.3.4 pact-jvm-provider-junit_2.11 2017-01-04 05:05:47 UTC
2.4.18 pact-jvm-provider-junit_2.11 2016-12-30 01:49:16 UTC
3.3.3 pact-jvm-provider-junit_2.11 2016-11-06 03:48:13 UTC
2.5.0-beta.0 pact-jvm-provider-junit_2.11 2016-10-22 12:56:40 UTC
3.3.2 pact-jvm-provider-junit_2.11 2016-10-22 08:59:12 UTC
2.4.17 pact-jvm-provider-junit_2.11 2016-10-22 07:03:08 UTC
3.3.1 pact-jvm-provider-junit_2.11 2016-10-02 03:50:50 UTC
2.4.16 pact-jvm-provider-junit_2.11 2016-10-01 21:38:54 UTC
3.5.0-beta.2 pact-jvm-provider-junit_2.11 2016-09-21 12:38:51 UTC
3.3.0 pact-jvm-provider-junit_2.11 2016-09-07 10:52:34 UTC
3.5.0-beta.1 pact-jvm-provider-junit_2.11 2016-08-28 11:19:26 UTC
2.4.15 pact-jvm-provider-junit_2.11 2016-08-23 12:57:20 UTC
3.2.13 pact-jvm-provider-junit_2.11 2016-08-14 01:53:39 UTC
3.2.12 pact-jvm-provider-junit_2.11 2016-08-07 04:39:59 UTC
2.4.14 pact-jvm-provider-junit_2.11 2016-08-07 03:43:16 UTC
3.3.0-beta.0 pact-jvm-provider-junit_2.11 2016-07-31 09:04:36 UTC
3.2.11 pact-jvm-provider-junit_2.11 2016-07-31 06:30:23 UTC
2.4.13 pact-jvm-provider-junit_2.11 2016-07-31 05:12:28 UTC
3.2.10 pact-jvm-provider-junit_2.11 2016-07-15 04:16:28 UTC
2.4.12 pact-jvm-provider-junit_2.11 2016-07-15 03:01:02 UTC
3.2.9 pact-jvm-provider-junit_2.11 2016-07-06 05:37:48 UTC
2.4.11 pact-jvm-provider-junit_2.11 2016-07-06 05:16:29 UTC
3.2.8 pact-jvm-provider-junit_2.11 2016-06-18 04:27:49 UTC
2.4.10 pact-jvm-provider-junit_2.11 2016-06-17 23:20:25 UTC
3.2.7 pact-jvm-provider-junit_2.11 2016-05-04 04:59:57 UTC
2.4.9 pact-jvm-provider-junit_2.11 2016-05-04 02:45:35 UTC
3.2.6 pact-jvm-provider-junit_2.11 2016-03-29 03:21:11 UTC
2.4.8 pact-jvm-provider-junit_2.11 2016-03-29 02:26:14 UTC
3.2.5 pact-jvm-provider-junit_2.11 2016-03-25 01:58:14 UTC