All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Download all versions of pact-jvm-provider-junit_2.11 JAR files with all dependencies

Search JAR files by class name

pact-jvm-provider-junit_2.11 from group au.com.dius (version 2.4.6)

# 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. ## Example of 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"); } @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) } ``` ## Pact source The Pact runner will automatically collect pacts based on annotations on the test class. For this purpose there are 3 out-of-the-box options (files from a directory, files from a set of URLs or a pact broker) or you can easily add your own Pact source. **Note:** You can only define one source of pacts per test class. ### Download pacts from a pact-broker To use pacts from a Pact Broker, annotate the test class with `@PactBroker(host="host.of.pact.broker.com", port = "80")`. From _version 3.2.2/2.4.3+_ you can also specify the protocol, which defaults to "http". The pact broker will be queried for all pacts with the same name as the provider annotation. For example, test all pacts for the "Activity Service" in the pact broker: ```java @RunWith(PactRunner.class) @Provider("Activity Service") @PactBroker(host = "localhost", port = "80") public class PactJUnitTest { @TestTarget public final Target target = new HttpTarget(5050); } ``` #### _Version 3.2.3/2.4.4+_ - Using Java System properties The pact broker loader was updated to allow system properties to be used for the hostname, port or protocol. The port was changed to a string to allow expressions to be set. To use a system property or environment variable, you can place the property name in `${}` expression de-markers: ```java @PactBroker(host="${pactbroker.hostname}", port = "80") ``` You can provide a default value by separating the property name with a colon (`:`): ```java @PactBroker(host="${pactbroker.hostname:localhost}", port = "80") ``` #### _Version 3.2.4/2.4.6+_ - Using tags with the pact broker The pact broker allows different versions to be tagged. To load all the pacts: ```java @PactBroker(host="pactbroker", port = "80", tags = {"latest", "dev", "prod"}) ``` The `latest` tag corresponds to the latest version ignoring the tags, and is the default. ### Pact Url To use pacts from urls annotate the test class with ```java @PactUrl(urls = {"http://build.server/zoo_app-animal_service.json"} ) ``` ### Pact folder To use pacts from a resource folder of the project annotate test class with ```java @PactFolder("subfolder/in/resource/directory") ``` ### Custom pacts source It's possible to use a custom Pact source. For this, implement interface `au.com.dius.pact.provider.junit.loader.PactLoader` and annotate the test class with `@PactSource(MyOwnPactLoader.class)`. **Note:** class `MyOwnPactLoader` must have a default constructor. ## Test target The field in test class of type `au.com.dius.pact.provider.junit.target.Target` annotated with `au.com.dius.pact.provider.junit.target.TestTarget` will be used for actual Interaction execution and asserting of contract. **Note:** there must be exactly 1 such field, otherwise an `InitializationException` will be thrown. ### HttpTarget `au.com.dius.pact.provider.junit.target.HttpTarget` - out-of-the-box implementation of `au.com.dius.pact.provider.junit.target.Target` that will play pacts as http request and assert response from service by matching rules from pact. _Version 3.2.2/2.4.3+_ you can also specify the protocol, defaults to "http". #### Modifying the requests before they are sent [Version 3.2.3/2.4.5+] Sometimes you may need to add things to the requests that can't be persisted in a pact file. Examples of these would be authentication tokens, which have a small life span. The HttpTarget supports request filters by annotating methods on the test class with `@TargetRequestFilter`. These methods must be public void methods that take a single HttpRequest parameter. For example: ```java @TargetRequestFilter public void exampleRequestFilter(HttpRequest request) { request.addHeader("Authorization", "OAUTH hdsagasjhgdjashgdah..."); } ``` __*Important Note:*__ You should only use this feature for things that can not be persisted in the pact file. By modifying the request, you are potentially modifying the contract from the consumer tests! ### Custom Test Target It's possible to use custom `Target`, for that interface `Target` should be implemented and this class can be used instead of `HttpTarget`.

Group: au.com.dius Artifact: pact-jvm-provider-junit_2.11
Show documentation Show source 
 

9 downloads
Artifact pact-jvm-provider-junit_2.11
Group au.com.dius
Version 2.4.6
Last update 19. February 2016
Tags: need using runwith supports schema targetrequestfilter exactly defaults pacturl feature afterclass place these oauth host static once loader project system fashionable addexpectation pactloader load each examples specify ways before dependent data execution life easy ability look tags define implemented field overview string documentation myawesomeservice library assert testing annotations public variable expression methods beforeclass provide change queried download same consumer must localhost after would updated println pactrunner markers setupservice hostname that against onrequestto subfolder require example collect span pactjunittest testtarget invoked annotated colon tested listens response possible json name pactfolder implement activity interactions protocol urls provides provider giveemptyresponse junit assertion annotate which source authentication take there service actual java server latest 8332 pacts httprequest they test otherwise modifying annotation file examplerequestfilter tokens only ignoring hdsagasjhgdjashgdah listed final information interaction prepare asserting create responses annotating start http will small filters port different easily build corresponds version tests embeddedservice httptarget clientdriverrule note options prod just files 5050 initializationexception mock persisted void should folder point _version directory method broker tagged based pactsource single sometimes separating authorization type where used changed potentially requests sent more request pactbroker value contracttest custom thrown appropriate such contract classrule here class property properties embedded requires expressions denotes environment pact default matching whole todefaultstate suite rest this addheader allow have state from purpose real parameter allows automatically rule find constructor with important your resource play strategy interface section rules zoo_app versions convenient implementation applied myownpactloader target instead animal_service runner things also dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 11
Dependencies junit, httpclient, pact-jvm-model_2.11, scala-compiler, fluent-hc, guava-retrying, pact-jvm-provider_2.11, commons-lang3, slf4j-api, jackson-databind, scala-library,
There are maybe transitive dependencies!

pact-jvm-provider-junit_2.11 from group au.com.dius (version 3.2.3)

# 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. ## Example of 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"); } @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) } ``` ## Pact source The Pact runner will automatically collect pacts based on annotations on the test class. For this purpose there are 3 out-of-the-box options (files from a directory, files from a set of URLs or a pact broker) or you can easily add your own Pact source. **Note:** You can only define one source of pacts per test class. ### Download pacts from a pact-broker To use pacts from a Pact Broker, annotate the test class with `@PactBroker(host="host.of.pact.broker.com", port = "80")`. From _version 3.2.2/2.4.3+_ you can also specify the protocol, which defaults to "http". The pact broker will be queried for all pacts with the same name as the provider annotation. For example, test all pacts for the "Activity Service" in the pact broker: ```java @RunWith(PactRunner.class) @Provider("Activity Service") @PactBroker(host = "localhost", port = "80") public class PactJUnitTest { @TestTarget public final Target target = new HttpTarget(5050); } ``` #### _Version 3.2.3/2.4.4+_ - Using Java System properties The pact broker loader was updated to allow system properties to be used for the hostname, port or protocol. The port was changed to a string to allow expressions to be set. To use a system property or environment variable, you can place the property name in `${}` expression de-markers: ```java @PactBroker(host="${pactbroker.hostname}", port = "80") ``` You can provide a default value by separating the property name with a colon (`:`): ```java @PactBroker(host="${pactbroker.hostname:localhost}", port = "80") ``` ### Pact Url To use pacts from urls annotate the test class with ```java @PactUrl(urls = {"http://build.server/zoo_app-animal_service.json"} ) ``` ### Pact folder To use pacts from a resource folder of the project annotate test class with ```java @PactFolder("subfolder/in/resource/directory") ``` ### Custom pacts source It's possible to use a custom Pact source. For this, implement interface `au.com.dius.pact.provider.junit.loader.PactLoader` and annotate the test class with `@PactSource(MyOwnPactLoader.class)`. **Note:** class `MyOwnPactLoader` must have a default constructor. ## Test target The field in test class of type `au.com.dius.pact.provider.junit.target.Target` annotated with `au.com.dius.pact.provider.junit.target.TestTarget` will be used for actual Interaction execution and asserting of contract. **Note:** there must be exactly 1 such field, otherwise an `InitializationException` will be thrown. ### HttpTarget `au.com.dius.pact.provider.junit.target.HttpTarget` - out-of-the-box implementation of `au.com.dius.pact.provider.junit.target.Target` that will play pacts as http request and assert response from service by matching rules from pact. _Version 3.2.2/2.4.3+_ you can also specify the protocol, defaults to "http". #### Modifying the requests before they are sent [Version 3.2.3/2.4.5+] Sometimes you may need to add things to the requests that can't be persisted in a pact file. Examples of these would be authentication tokens, which have a small life span. The HttpTarget supports request filters by annotating methods on the test class with `@TargetRequestFilter`. These methods must be public void methods that take a single HttpRequest parameter. For example: ```java @TargetRequestFilter public void exampleRequestFilter(HttpRequest request) { request.addHeader("Authorization", "OAUTH hdsagasjhgdjashgdah..."); } ``` __*Important Note:*__ You should only use this feature for things that can not be persisted in the pact file. By modifying the request, you are potentially modifying the contract from the consumer tests! ### Custom Test Target It's possible to use custom `Target`, for that interface `Target` should be implemented and this class can be used instead of `HttpTarget`.

Group: au.com.dius Artifact: pact-jvm-provider-junit_2.11
Show documentation Show source 
 

9 downloads
Artifact pact-jvm-provider-junit_2.11
Group au.com.dius
Version 3.2.3
Last update 11. February 2016
Tags: need using runwith supports schema targetrequestfilter exactly defaults pacturl feature afterclass place these oauth host static once loader project system fashionable addexpectation pactloader load each examples specify ways before dependent data execution life easy ability look define implemented field overview string documentation myawesomeservice library assert testing annotations public variable expression methods beforeclass provide change queried download same consumer must localhost after would updated println pactrunner markers setupservice hostname that against onrequestto subfolder require example collect span pactjunittest testtarget invoked annotated colon tested listens response possible json name pactfolder implement activity interactions protocol urls provides provider junit giveemptyresponse assertion annotate which source authentication take there service actual java server 8332 pacts httprequest they test otherwise modifying annotation file examplerequestfilter tokens only hdsagasjhgdjashgdah listed final information interaction prepare asserting create responses annotating start http will small filters port easily build version tests embeddedservice httptarget clientdriverrule note options just files 5050 mock initializationexception persisted void should folder point _version directory method broker based pactsource single sometimes separating authorization where used type changed potentially requests sent more request pactbroker value contracttest custom thrown appropriate such contract classrule here class property properties embedded requires expressions denotes environment pact matching default whole todefaultstate suite rest this addheader allow have state from purpose real parameter automatically rule find constructor with important your resource play strategy interface section rules zoo_app convenient implementation applied myownpactloader target instead animal_service runner things also dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 12
Dependencies scala-logging_2.11, junit, httpclient, scala-compiler, fluent-hc, guava-retrying, pact-jvm-model_2.11, commons-lang3, slf4j-api, jackson-databind, pact-jvm-provider_2.11, scala-library,
There are maybe transitive dependencies!

pact-jvm-provider-junit_2.11 from group au.com.dius (version 2.4.5)

# 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. ## Example of 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"); } @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) } ``` ## Pact source The Pact runner will automatically collect pacts based on annotations on the test class. For this purpose there are 3 out-of-the-box options (files from a directory, files from a set of URLs or a pact broker) or you can easily add your own Pact source. **Note:** You can only define one source of pacts per test class. ### Download pacts from a pact-broker To use pacts from a Pact Broker, annotate the test class with `@PactBroker(host="host.of.pact.broker.com", port = "80")`. From _version 3.2.2/2.4.3+_ you can also specify the protocol, which defaults to "http". The pact broker will be queried for all pacts with the same name as the provider annotation. For example, test all pacts for the "Activity Service" in the pact broker: ```java @RunWith(PactRunner.class) @Provider("Activity Service") @PactBroker(host = "localhost", port = "80") public class PactJUnitTest { @TestTarget public final Target target = new HttpTarget(5050); } ``` #### _Version 3.2.3/2.4.4+_ - Using Java System properties The pact broker loader was updated to allow system properties to be used for the hostname, port or protocol. The port was changed to a string to allow expressions to be set. To use a system property or environment variable, you can place the property name in `${}` expression de-markers: ```java @PactBroker(host="${pactbroker.hostname}", port = "80") ``` You can provide a default value by separating the property name with a colon (`:`): ```java @PactBroker(host="${pactbroker.hostname:localhost}", port = "80") ``` ### Pact Url To use pacts from urls annotate the test class with ```java @PactUrl(urls = {"http://build.server/zoo_app-animal_service.json"} ) ``` ### Pact folder To use pacts from a resource folder of the project annotate test class with ```java @PactFolder("subfolder/in/resource/directory") ``` ### Custom pacts source It's possible to use a custom Pact source. For this, implement interface `au.com.dius.pact.provider.junit.loader.PactLoader` and annotate the test class with `@PactSource(MyOwnPactLoader.class)`. **Note:** class `MyOwnPactLoader` must have a default constructor. ## Test target The field in test class of type `au.com.dius.pact.provider.junit.target.Target` annotated with `au.com.dius.pact.provider.junit.target.TestTarget` will be used for actual Interaction execution and asserting of contract. **Note:** there must be exactly 1 such field, otherwise an `InitializationException` will be thrown. ### HttpTarget `au.com.dius.pact.provider.junit.target.HttpTarget` - out-of-the-box implementation of `au.com.dius.pact.provider.junit.target.Target` that will play pacts as http request and assert response from service by matching rules from pact. _Version 3.2.2/2.4.3+_ you can also specify the protocol, defaults to "http". #### Modifying the requests before they are sent [Version 3.2.3/2.4.5+] Sometimes you may need to add things to the requests that can't be persisted in a pact file. Examples of these would be authentication tokens, which have a small life span. The HttpTarget supports request filters by annotating methods on the test class with `@TargetRequestFilter`. These methods must be public void methods that take a single HttpRequest parameter. For example: ```java @TargetRequestFilter public void exampleRequestFilter(HttpRequest request) { request.addHeader("Authorization", "OAUTH hdsagasjhgdjashgdah..."); } ``` __*Important Note:*__ You should only use this feature for things that can not be persisted in the pact file. By modifying the request, you are potentially modifying the contract from the consumer tests! ### Custom Test Target It's possible to use custom `Target`, for that interface `Target` should be implemented and this class can be used instead of `HttpTarget`.

Group: au.com.dius Artifact: pact-jvm-provider-junit_2.11
Show documentation Show source 
 

9 downloads
Artifact pact-jvm-provider-junit_2.11
Group au.com.dius
Version 2.4.5
Last update 11. February 2016
Tags: need using runwith supports schema targetrequestfilter exactly defaults pacturl feature afterclass place these oauth host static once loader project system fashionable addexpectation pactloader load each examples specify ways before dependent data execution life easy ability look define implemented field overview string documentation myawesomeservice library assert testing annotations public variable expression methods beforeclass provide change queried download same consumer must localhost after would updated println pactrunner markers setupservice hostname that against onrequestto subfolder require example collect span pactjunittest testtarget invoked annotated colon tested listens response possible json name pactfolder implement activity interactions protocol urls provides provider junit giveemptyresponse assertion annotate which source authentication take there service actual java server 8332 pacts httprequest they test otherwise modifying annotation file examplerequestfilter tokens only hdsagasjhgdjashgdah listed final information interaction prepare asserting create responses annotating start http will small filters port easily build version tests embeddedservice httptarget clientdriverrule note options just files 5050 mock initializationexception persisted void should folder point _version directory method broker based pactsource single sometimes separating authorization where used type changed potentially requests sent more request pactbroker value contracttest custom thrown appropriate such contract classrule here class property properties embedded requires expressions denotes environment pact matching default whole todefaultstate suite rest this addheader allow have state from purpose real parameter automatically rule find constructor with important your resource play strategy interface section rules zoo_app convenient implementation applied myownpactloader target instead animal_service runner things also dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 11
Dependencies commons-lang3, slf4j-api, guava-retrying, scala-compiler, scala-library, jackson-databind, httpclient, junit, pact-jvm-model_2.11, fluent-hc, pact-jvm-provider_2.11,
There are maybe transitive dependencies!

pact-jvm-provider-junit_2.11 from group au.com.dius (version 2.4.4)

# Pact junit runner ## Overview Library provides ability to play contract tests against 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 interaction - **au.com.dius.pact.provider.junit.State** custom annotation - before each interaction that require state change, all methods annotated by State with appropriate state listed will be invoked ## Example of 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"); } @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) } ``` ## Pacts source Pact runner will automatically collect pacts: for this purpose there are 2 out-of-the-box options or you can easily add your own Pact source. **Note:** it's possible to use only one source of pacts. ### Download pacts from pact-broker To use pacts from Pact Broker annotate test class with `@PactBroker(host="host.of.pact.broker.com", port = 80)`. Version 3.2.2/2.4.3+ you can also specify the protocol, defaults to 'http'. ### Pact Url To use pacts from urls annotate test class with `@PactUrl(urls = {http://build.server/zoo_app-animal_service.json} )`. ### Pact folder To use pacts from resource folder of project annotate test class with `@PactFolder("subfolder/in/resource/directory")`. ### Custom pacts source It's possible to use custom Pact source: for this implement `interface au.com.dius.pact.provider.junit.loader.PactLoader` and annotate test class with `@PactSource(MyOwnPactLoader.class)`. **Note:** `class MyOwnPactLoader` should have default constructor. ## Test target Field in test class of type `au.com.dius.pact.provider.junit.target.Target` annotated with `au.com.dius.pact.provider.junit.target.TestTarget` will be used for actual Interaction execution and asserting of contract. **Note:** should be exactly 1 such field, otherwise `InitializationException` will be thrown. ### HttpTarget `au.com.dius.pact.provider.junit.target.HttpTarget` - out-of-the-box implementation of `au.com.dius.pact.provider.junit.target.Target` that will play pacts as http request and assert response from service by matching rules from pact. Version 3.2.2/2.4.3+ you can also specify the protocol, defaults to 'http'. ### Custom Test Target It's possible to use custom `Target` for that `interface Target` should be implemented and this class can be used instead of `HttpTarget`.

Group: au.com.dius Artifact: pact-jvm-provider-junit_2.11
Show documentation Show source 
 

9 downloads
Artifact pact-jvm-provider-junit_2.11
Group au.com.dius
Version 2.4.4
Last update 20. January 2016
Tags: test runwith otherwise supports schema annotation exactly defaults pacturl only afterclass listed information final host static once loader interaction prepare asserting create responses project system addexpectation fashionable start http pactloader will load each specify ways port before dependent data easily build version execution easy tests embeddedservice httptarget clientdriverrule ability note options look just initializationexception mock implemented void should field folder point overview directory library myawesomeservice documentation assert testing method annotations broker public pactsource methods beforeclass change download type used where after requests more println request pactbroker contracttest custom pactrunner thrown appropriate such contract classrule setupservice class here embedded that denotes default pact matching whole against todefaultstate onrequestto require subfolder rest example suite this collect have testtarget state invoked annotated purpose from listens tested response real possible json automatically name rule pactfolder implement find interactions constructor with protocol urls your play resource strategy provides provider giveemptyresponse junit assertion interface annotate section rules zoo_app convenient source implementation take applied there service target myownpactloader instead actual java server animal_service runner 8332 also pacts dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 11
Dependencies junit, httpclient, pact-jvm-model_2.11, scala-compiler, fluent-hc, pact-jvm-provider_2.11, guava-retrying, commons-lang3, slf4j-api, jackson-databind, scala-library,
There are maybe transitive dependencies!

pact-jvm-provider-junit_2.11 from group au.com.dius (version 3.2.2)

# Pact junit runner ## Overview Library provides ability to play contract tests against 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 interaction - **au.com.dius.pact.provider.junit.State** custom annotation - before each interaction that require state change, all methods annotated by State with appropriate state listed will be invoked ## Example of 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"); } @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) } ``` ## Pacts source Pact runner will automatically collect pacts: for this purpose there are 2 out-of-the-box options or you can easily add your own Pact source. **Note:** it's possible to use only one source of pacts. ### Download pacts from pact-broker To use pacts from Pact Broker annotate test class with `@PactBroker(host="host.of.pact.broker.com", port = 80)`. Version 3.2.2/2.4.3+ you can also specify the protocol, defaults to 'http'. ### Pact Url To use pacts from urls annotate test class with `@PactUrl(urls = {http://build.server/zoo_app-animal_service.json} )`. ### Pact folder To use pacts from resource folder of project annotate test class with `@PactFolder("subfolder/in/resource/directory")`. ### Custom pacts source It's possible to use custom Pact source: for this implement `interface au.com.dius.pact.provider.junit.loader.PactLoader` and annotate test class with `@PactSource(MyOwnPactLoader.class)`. **Note:** `class MyOwnPactLoader` should have default constructor. ## Test target Field in test class of type `au.com.dius.pact.provider.junit.target.Target` annotated with `au.com.dius.pact.provider.junit.target.TestTarget` will be used for actual Interaction execution and asserting of contract. **Note:** should be exactly 1 such field, otherwise `InitializationException` will be thrown. ### HttpTarget `au.com.dius.pact.provider.junit.target.HttpTarget` - out-of-the-box implementation of `au.com.dius.pact.provider.junit.target.Target` that will play pacts as http request and assert response from service by matching rules from pact. Version 3.2.2/2.4.3+ you can also specify the protocol, defaults to 'http'. ### Custom Test Target It's possible to use custom `Target` for that `interface Target` should be implemented and this class can be used instead of `HttpTarget`.

Group: au.com.dius Artifact: pact-jvm-provider-junit_2.11
Show documentation Show source 
 

9 downloads
Artifact pact-jvm-provider-junit_2.11
Group au.com.dius
Version 3.2.2
Last update 17. January 2016
Tags: test runwith otherwise supports schema annotation exactly defaults pacturl only afterclass listed information final host static once loader interaction prepare asserting create responses project system addexpectation fashionable start http pactloader will load each specify ways port before dependent data easily build version execution easy tests embeddedservice httptarget clientdriverrule ability note options look just initializationexception mock implemented void should field folder point overview directory library myawesomeservice documentation assert testing method annotations broker public pactsource methods beforeclass change download type used where after requests more println request pactbroker contracttest custom pactrunner thrown appropriate such contract classrule setupservice class here embedded that denotes default pact matching whole against todefaultstate onrequestto require subfolder rest example suite this collect have testtarget state invoked annotated purpose from listens tested response real possible json automatically name rule pactfolder implement find interactions constructor with protocol urls your play resource strategy provides provider giveemptyresponse junit assertion interface annotate section rules zoo_app convenient source implementation take applied there service target myownpactloader instead actual java server animal_service runner 8332 also pacts dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 12
Dependencies scala-logging_2.11, junit, httpclient, scala-compiler, fluent-hc, guava-retrying, pact-jvm-model_2.11, commons-lang3, slf4j-api, pact-jvm-provider_2.11, jackson-databind, scala-library,
There are maybe transitive dependencies!

pact-jvm-provider-junit_2.11 from group au.com.dius (version 2.4.3)

# Pact junit runner ## Overview Library provides ability to play contract tests against 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 interaction - **au.com.dius.pact.provider.junit.State** custom annotation - before each interaction that require state change, all methods annotated by State with appropriate state listed will be invoked ## Example of 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"); } @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) } ``` ## Pacts source Pact runner will automatically collect pacts: for this purpose there are 2 out-of-the-box options or you can easily add your own Pact source. **Note:** it's possible to use only one source of pacts. ### Download pacts from pact-broker To use pacts from Pact Broker annotate test class with `@PactBroker(host="host.of.pact.broker.com", port = 80)`. Version 3.2.2/2.4.3+ you can also specify the protocol, defaults to 'http'. ### Pact Url To use pacts from urls annotate test class with `@PactUrl(urls = {http://build.server/zoo_app-animal_service.json} )`. ### Pact folder To use pacts from resource folder of project annotate test class with `@PactFolder("subfolder/in/resource/directory")`. ### Custom pacts source It's possible to use custom Pact source: for this implement `interface au.com.dius.pact.provider.junit.loader.PactLoader` and annotate test class with `@PactSource(MyOwnPactLoader.class)`. **Note:** `class MyOwnPactLoader` should have default constructor. ## Test target Field in test class of type `au.com.dius.pact.provider.junit.target.Target` annotated with `au.com.dius.pact.provider.junit.target.TestTarget` will be used for actual Interaction execution and asserting of contract. **Note:** should be exactly 1 such field, otherwise `InitializationException` will be thrown. ### HttpTarget `au.com.dius.pact.provider.junit.target.HttpTarget` - out-of-the-box implementation of `au.com.dius.pact.provider.junit.target.Target` that will play pacts as http request and assert response from service by matching rules from pact. Version 3.2.2/2.4.3+ you can also specify the protocol, defaults to 'http'. ### Custom Test Target It's possible to use custom `Target` for that `interface Target` should be implemented and this class can be used instead of `HttpTarget`.

Group: au.com.dius Artifact: pact-jvm-provider-junit_2.11
Show documentation Show source 
 

9 downloads
Artifact pact-jvm-provider-junit_2.11
Group au.com.dius
Version 2.4.3
Last update 17. January 2016
Tags: test runwith otherwise supports schema annotation exactly defaults pacturl only afterclass listed information final host static once loader interaction prepare asserting create responses project system addexpectation fashionable start http pactloader will load each specify ways port before dependent data easily build version execution easy tests embeddedservice httptarget clientdriverrule ability note options look just initializationexception mock implemented void should field folder point overview directory library myawesomeservice documentation assert testing method annotations broker public pactsource methods beforeclass change download type used where after requests more println request pactbroker contracttest custom pactrunner thrown appropriate such contract classrule setupservice class here embedded that denotes default pact matching whole against todefaultstate onrequestto require subfolder rest example suite this collect have testtarget state invoked annotated purpose from listens tested response real possible json automatically name rule pactfolder implement find interactions constructor with protocol urls your play resource strategy provides provider giveemptyresponse junit assertion interface annotate section rules zoo_app convenient source implementation take applied there service target myownpactloader instead actual java server animal_service runner 8332 also pacts dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 11
Dependencies junit, httpclient, scala-compiler, pact-jvm-provider_2.11, fluent-hc, pact-jvm-model_2.11, guava-retrying, commons-lang3, slf4j-api, jackson-databind, scala-library,
There are maybe transitive dependencies!

pact-jvm-provider-junit_2.11 from group au.com.dius (version 3.2.1)

# Pact junit runner ## Overview Library provides ability to play contract tests against 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 interaction - **au.com.dius.pact.provider.junit.State** custom annotation - before each interaction that require state change, all methods annotated by State with appropriate state listed will be invoked ## Example of 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"); } @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) } ``` ## Pacts source Pact runner will automatically collect pacts: for this purpose there are 2 out-of-the-box options or you can easily add your own Pact source. **Note:** it's possible to use only one source of pacts. ### Download pacts from pact-broker To use pacts from Pact Broker annotate test class with `@PactBroker(host="host.of.pact.broker.com", port = 80)`. ### Pact Url To use pacts from urls annotate test class with `@PactUrl(urls = {http://build.server/zoo_app-animal_service.json} )`. ### Pact folder To use pacts from resource folder of project annotate test class with `@PactFolder("subfolder/in/resource/directory")`. ### Custom pacts source It's possible to use custom Pact source: for this implement `interface au.com.dius.pact.provider.junit.loader.PactLoader` and annotate test class with `@PactSource(MyOwnPactLoader.class)`. **Note:** `class MyOwnPactLoader` should have default constructor. ## Test target Field in test class of type `au.com.dius.pact.provider.junit.target.Target` annotated with `au.com.dius.pact.provider.junit.target.TestTarget` will be used for actual Interaction execution and asserting of contract. **Note:** should be exactly 1 such field, otherwise `InitializationException` will be thrown. ### HttpTarget `au.com.dius.pact.provider.junit.target.HttpTarget` - out-of-the-box implementation of `au.com.dius.pact.provider.junit.target.Target` that will play pacts as http request and assert response from service by matching rules from pact. ### Custom Test Target It's possible to use custom `Target` for that `interface Target` should be implemented and this class can be used instead of `HttpTarget`.

Group: au.com.dius Artifact: pact-jvm-provider-junit_2.11
Show documentation Show source 
 

9 downloads
Artifact pact-jvm-provider-junit_2.11
Group au.com.dius
Version 3.2.1
Last update 12. December 2015
Tags: test runwith otherwise supports schema annotation exactly pacturl only afterclass listed final information host static once loader interaction prepare asserting create responses project system addexpectation fashionable start http pactloader will load each ways port before dependent data easily build execution easy tests embeddedservice httptarget clientdriverrule note ability options look just initializationexception mock implemented void should field folder point overview directory library myawesomeservice documentation assert testing method annotations broker public pactsource methods beforeclass change download type used where after requests more println request pactbroker contracttest custom pactrunner thrown appropriate such contract classrule setupservice class here embedded denotes that default pact matching whole against todefaultstate onrequestto require subfolder rest example suite this collect have testtarget state invoked annotated purpose from listens tested response real possible json automatically name rule pactfolder implement find interactions constructor with urls your play resource strategy provides provider giveemptyresponse junit assertion interface annotate section rules zoo_app convenient source implementation take applied there service target myownpactloader instead actual java server animal_service runner 8332 also pacts dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 12
Dependencies scala-logging_2.11, junit, httpclient, pact-jvm-model_2.11, scala-compiler, fluent-hc, guava-retrying, pact-jvm-provider_2.11, commons-lang3, slf4j-api, jackson-databind, scala-library,
There are maybe transitive dependencies!

pact-jvm-provider-junit_2.11 from group au.com.dius (version 2.4.2)

# Pact junit runner ## Overview Library provides ability to play contract tests against 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 interaction - **au.com.dius.pact.provider.junit.State** custom annotation - before each interaction that require state change, all methods annotated by State with appropriate state listed will be invoked ## Example of 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"); } @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) } ``` ## Pacts source Pact runner will automatically collect pacts: for this purpose there are 2 out-of-the-box options or you can easily add your own Pact source. **Note:** it's possible to use only one source of pacts. ### Download pacts from pact-broker To use pacts from Pact Broker annotate test class with `@PactBroker(host="host.of.pact.broker.com", port = 80)`. ### Pact Url To use pacts from urls annotate test class with `@PactUrl(urls = {http://build.server/zoo_app-animal_service.json} )`. ### Pact folder To use pacts from resource folder of project annotate test class with `@PactFolder("subfolder/in/resource/directory")`. ### Custom pacts source It's possible to use custom Pact source: for this implement `interface au.com.dius.pact.provider.junit.loader.PactLoader` and annotate test class with `@PactSource(MyOwnPactLoader.class)`. **Note:** `class MyOwnPactLoader` should have default constructor. ## Test target Field in test class of type `au.com.dius.pact.provider.junit.target.Target` annotated with `au.com.dius.pact.provider.junit.target.TestTarget` will be used for actual Interaction execution and asserting of contract. **Note:** should be exactly 1 such field, otherwise `InitializationException` will be thrown. ### HttpTarget `au.com.dius.pact.provider.junit.target.HttpTarget` - out-of-the-box implementation of `au.com.dius.pact.provider.junit.target.Target` that will play pacts as http request and assert response from service by matching rules from pact. ### Custom Test Target It's possible to use custom `Target` for that `interface Target` should be implemented and this class can be used instead of `HttpTarget`.

Group: au.com.dius Artifact: pact-jvm-provider-junit_2.11
Show documentation Show source 
 

9 downloads
Artifact pact-jvm-provider-junit_2.11
Group au.com.dius
Version 2.4.2
Last update 12. December 2015
Tags: test runwith otherwise supports schema annotation exactly pacturl only afterclass listed final information host static once loader interaction prepare asserting create responses project system addexpectation fashionable start http pactloader will load each ways port before dependent data easily build execution easy tests embeddedservice httptarget clientdriverrule note ability options look just initializationexception mock implemented void should field folder point overview directory library myawesomeservice documentation assert testing method annotations broker public pactsource methods beforeclass change download type used where after requests more println request pactbroker contracttest custom pactrunner thrown appropriate such contract classrule setupservice class here embedded denotes that default pact matching whole against todefaultstate onrequestto require subfolder rest example suite this collect have testtarget state invoked annotated purpose from listens tested response real possible json automatically name rule pactfolder implement find interactions constructor with urls your play resource strategy provides provider giveemptyresponse junit assertion interface annotate section rules zoo_app convenient source implementation take applied there service target myownpactloader instead actual java server animal_service runner 8332 also pacts dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 11
Dependencies junit, httpclient, pact-jvm-provider_2.11, scala-compiler, pact-jvm-model_2.11, fluent-hc, guava-retrying, commons-lang3, slf4j-api, jackson-databind, scala-library,
There are maybe transitive dependencies!

pact-jvm-provider-junit_2.11 from group au.com.dius (version 3.2.0)

# Pact junit runner ## Overview Library provides ability to play contract tests against 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 interaction - **au.com.dius.pact.provider.junit.State** custom annotation - before each interaction that require state change, all methods annotated by State with appropriate state listed will be invoked ## Example of 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"); } @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) } ``` ## Pacts source Pact runner will automatically collect pacts: for this purpose there are 2 out-of-the-box options or you can easily add your own Pact source. **Note:** it's possible to use only one source of pacts. ### Download pacts from pact-broker To use pacts from Pact Broker annotate test class with `@PactBroker(host="host.of.pact.broker.com", port = 80)`. ### Pact folder To use pacts from resource folder of project annotate test class with `@PactFolder("subfolder/in/resource/directory")`. ### Custom pacts source It's possible to use custom Pact source: for this implement `interface au.com.dius.pact.provider.junit.loader.PactLoader` and annotate test class with `@PactSource(MyOwnPactLoader.class)`. **Note:** `class MyOwnPactLoader` should have default constructor. ## Test target Field in test class of type `au.com.dius.pact.provider.junit.target.Target` annotated with `au.com.dius.pact.provider.junit.target.TestTarget` will be used for actual Interaction execution and asserting of contract. **Note:** should be exactly 1 such field, otherwise `InitializationException` will be thrown. ### HttpTarget `au.com.dius.pact.provider.junit.target.HttpTarget` - out-of-the-box implementation of `au.com.dius.pact.provider.junit.target.Target` that will play pacts as http request and assert response from service by matching rules from pact. ### Custom Test Target It's possible to use custom `Target` for that `interface Target` should be implemented and this class can be used instead of `HttpTarget`.

Group: au.com.dius Artifact: pact-jvm-provider-junit_2.11
Show documentation Show source 
 

9 downloads
Artifact pact-jvm-provider-junit_2.11
Group au.com.dius
Version 3.2.0
Last update 28. November 2015
Tags: test runwith otherwise supports schema annotation exactly only afterclass listed final information host static once loader interaction prepare asserting create responses project system fashionable addexpectation start pactloader http will load each ways port before dependent data easily execution easy tests embeddedservice httptarget clientdriverrule note ability options just look initializationexception mock implemented void should field folder point overview directory library myawesomeservice documentation assert testing method annotations broker public pactsource methods beforeclass change download type used where after requests more println request pactbroker contracttest custom pactrunner thrown appropriate such contract classrule setupservice class here embedded denotes that default matching pact whole against todefaultstate onrequestto require subfolder rest example suite this collect have testtarget state invoked annotated purpose from listens tested response real possible automatically name rule pactfolder implement find interactions constructor with your play resource strategy provides provider giveemptyresponse junit assertion interface annotate section rules convenient source implementation take applied there service target myownpactloader instead actual java runner 8332 also pacts dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 12
Dependencies scala-logging_2.11, junit, scala-compiler, guava-retrying, pact-jvm-model_2.11, fluent-hc, pact-jvm-provider_2.11, httpclient, commons-lang3, slf4j-api, jackson-databind, scala-library,
There are maybe transitive dependencies!

pact-jvm-provider-junit_2.11 from group au.com.dius (version 2.4.1)

# Pact junit runner ## Overview Library provides ability to play contract tests against 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 interaction - **au.com.dius.pact.provider.junit.State** custom annotation - before each interaction that require state change, all methods annotated by State with appropriate state listed will be invoked ## Example of 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"); } @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) } ``` ## Pacts source Pact runner will automatically collect pacts: for this purpose there are 2 out-of-the-box options or you can easily add your own Pact source. **Note:** it's possible to use only one source of pacts. ### Download pacts from pact-broker To use pacts from Pact Broker annotate test class with `@PactBroker(host="host.of.pact.broker.com", port = 80)`. ### Pact folder To use pacts from resource folder of project annotate test class with `@PactFolder("subfolder/in/resource/directory")`. ### Custom pacts source It's possible to use custom Pact source: for this implement `interface au.com.dius.pact.provider.junit.loader.PactLoader` and annotate test class with `@PactSource(MyOwnPactLoader.class)`. **Note:** `class MyOwnPactLoader` should have default constructor. ## Test target Field in test class of type `au.com.dius.pact.provider.junit.target.Target` annotated with `au.com.dius.pact.provider.junit.target.TestTarget` will be used for actual Interaction execution and asserting of contract. **Note:** should be exactly 1 such field, otherwise `InitializationException` will be thrown. ### HttpTarget `au.com.dius.pact.provider.junit.target.HttpTarget` - out-of-the-box implementation of `au.com.dius.pact.provider.junit.target.Target` that will play pacts as http request and assert response from service by matching rules from pact. ### Custom Test Target It's possible to use custom `Target` for that `interface Target` should be implemented and this class can be used instead of `HttpTarget`.

Group: au.com.dius Artifact: pact-jvm-provider-junit_2.11
Show documentation Show source 
 

9 downloads
Artifact pact-jvm-provider-junit_2.11
Group au.com.dius
Version 2.4.1
Last update 28. November 2015
Tags: test runwith otherwise supports schema annotation exactly only afterclass listed final information host static once loader interaction prepare asserting create responses project system fashionable addexpectation start pactloader http will load each ways port before dependent data easily execution easy tests embeddedservice httptarget clientdriverrule note ability options just look initializationexception mock implemented void should field folder point overview directory library myawesomeservice documentation assert testing method annotations broker public pactsource methods beforeclass change download type used where after requests more println request pactbroker contracttest custom pactrunner thrown appropriate such contract classrule setupservice class here embedded denotes that default matching pact whole against todefaultstate onrequestto require subfolder rest example suite this collect have testtarget state invoked annotated purpose from listens tested response real possible automatically name rule pactfolder implement find interactions constructor with your play resource strategy provides provider giveemptyresponse junit assertion interface annotate section rules convenient source implementation take applied there service target myownpactloader instead actual java runner 8332 also pacts dius
Organization not specified
URL https://github.com/DiUS/pact-jvm
License Apache 2
Dependencies amount 11
Dependencies junit, pact-jvm-provider_2.11, scala-compiler, guava-retrying, fluent-hc, httpclient, pact-jvm-model_2.11, commons-lang3, slf4j-api, jackson-databind, scala-library,
There are maybe transitive dependencies!



Page 9 from 10 (items total 93)


© 2015 - 2024 Weber Informatics LLC | Privacy Policy