au.com.dius:pact-jvm-provider-junit_2.11:3.5.2

Group / Artifact / Version au.com.dius / pact-jvm-provider-junit_2.11 / 3.5.2
Namepact-jvm-provider-junit_2.11
Description# 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() {
Last modified2017-07-12 01:12:06 UTC
URL https://github.com/DiUS/pact-jvm
Repository URL http://repo1.maven.org/maven2/au/com/dius/pact-jvm-provider-junit_2.11/3.5.2/
Packaging jar
POM File View
Effective POM File View
Dependency tag
<dependency>
  <groupId>au.com.dius</groupId>
  <artifactId>pact-jvm-provider-junit_2.11</artifactId>
  <version>3.5.2</version>
</dependency>
'au.com.dius:pact-jvm-provider-junit_2.11:jar:3.5.2'
<dependency org="au.com.dius" name="pact-jvm-provider-junit_2.11" rev="3.5.2" />
@Grapes(@Grab(group='au.com.dius', module='pact-jvm-provider-junit_2.11', version='3.5.2'))
compile 'au.com.dius:pact-jvm-provider-junit_2.11:3.5.2'
libraryDependencies += "au.com.dius" % "pact-jvm-provider-junit_2.11" % "3.5.2"
Repository tag
  <repository>
    <id>central</id>
    <url>http://repo1.maven.org/maven2/</url>
  </repository>
Used by
Packages

au.com.dius.pact.provider.junit

au.com.dius.pact.provider.junit.loader

au.com.dius.pact.provider.junit.sysprops

au.com.dius.pact.provider.junit.target

SCM
  Urlhttps://github.com/DiUS/pact-jvm
  Connectionhttps://github.com/DiUS/pact-jvm.git
Dependencies
GroupArtifactVersion
org.jetbrains.kotlinkotlin-stdlib-jre81.1.2-5
org.jetbrains.kotlinkotlin-reflect1.1.2-5
org.slf4jslf4j-api1.7.21
org.codehaus.groovygroovy-all2.4.10
io.github.microutilskotlin-logging1.4.4
org.scala-langscala-library2.11.8
org.scala-langscala-compiler2.11.8
com.typesafe.scala-loggingscala-logging_2.113.4.0
au.com.diuspact-jvm-provider_2.113.5.2
com.github.rholderguava-retrying2.0.0
org.apache.httpcomponentsfluent-hc4.5.2
org.apache.httpcomponentshttpclient4.5.2
junitjunit4.12
org.apache.commonscommons-lang33.4
com.fasterxml.jackson.corejackson-databind2.8.1
org.jooqjool0.9.11
org.specs2specs2-core_2.113.8.4
org.specs2specs2-junit_2.113.8.4
org.hamcresthamcrest-all1.3
org.mockitomockito-core1.10.19
org.spockframeworkspock-core1.1-groovy-2.4
cglibcglib3.2.4
org.objenesisobjenesis2.4
com.github.rest-driverrest-client-driver1.1.45
ch.qos.logbacklogback-classic1.1.7
org.apache.commonscommons-collections44.1
Plugins
GroupArtifactVersion
org.apache.maven.pluginsmaven-clean-plugin2.5
org.apache.maven.pluginsmaven-resources-plugin2.6
org.apache.maven.pluginsmaven-jar-plugin2.4
org.apache.maven.pluginsmaven-compiler-plugin3.1
org.apache.maven.pluginsmaven-surefire-plugin2.12.4
org.apache.maven.pluginsmaven-install-plugin2.4
org.apache.maven.pluginsmaven-deploy-plugin2.7
org.apache.maven.pluginsmaven-site-plugin3.3
Licenses
  NameApache 2
  Urlhttp://www.apache.org/licenses/LICENSE-2.0.txt
  Distributionrepo