public class PactProviderRule
A junit rule that wraps every test annotated with . Before each test, a mock server will be setup at given port/host that will provide mocked responses for the given provider. After each test, it will be teared down. If no host is given, it will default to localhost. If no port is given, it will default to a random port.annotationclass PactVerification
annotationclass PactVerificationpublic PactProviderRule(java.lang.String provider,
java.lang.String host,
java.lang.Integer port,
au.com.dius.pact.model.PactSpecVersion pactVersion,
java.lang.Object target)
Creates a mock provider by the given name
provider - Provider name to mockhost - Host to bind to. Defaults to localhostport - Port to bind to. Defaults to a random port.pactVersion - Pact specification versiontarget - Target test to apply this rule to.public PactProviderRule(java.lang.String provider,
java.lang.String host,
java.lang.Integer port,
boolean https,
au.com.dius.pact.model.PactSpecVersion pactVersion,
java.lang.Object target)
Creates a mock provider by the given name
provider - Provider name to mockhost - Host to bind to. Defaults to localhostport - Port to bind to. Defaults to a random port.https - Boolean flag to control starting HTTPS or HTTP mock serverpactVersion - Pact specification versiontarget - Target test to apply this rule to.public PactProviderRule(java.lang.String provider,
java.lang.String host,
java.lang.Integer port,
boolean https,
java.lang.String keystore,
java.lang.String password,
au.com.dius.pact.model.PactSpecVersion pactVersion,
java.lang.Object target)
Creates a mock provider by the given name
provider - Provider name to mockhost - Host to bind to. Defaults to localhostport - Port to bind to. Defaults to a random port.https - Boolean flag to control starting HTTPS or HTTP mock serverkeystore - Path to keystore, example: /path/to/keystore.jkspassword - Password for the keystore.pactVersion - Pact specification versiontarget - Target test to apply this rule to.public PactProviderRule(java.lang.String provider,
java.lang.String host,
java.lang.Integer port,
java.lang.Object target)
Creates a mock provider by the given name
provider - Provider name to mockhost - Host to bind to. Defaults to localhostport - Port to bind to. Defaults to a random port.target - Target test to apply this rule to.public PactProviderRule(java.lang.String provider,
java.lang.Object target)
Creates a mock provider by the given name. Binds to localhost and a random port.
provider - Provider name to mocktarget - Target test to apply this rule to.public PactProviderRule(java.lang.String provider,
au.com.dius.pact.model.PactSpecVersion pactSpecVersion,
java.lang.Object target)
Creates a mock provider by the given name. Binds to localhost and a random port.
provider - Provider name to mocktarget - Target test to apply this rule to.public au.com.dius.pact.model.MockProviderConfig getConfig()
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
protected java.util.Map<java.lang.String,au.com.dius.pact.model.PactFragment> getPacts(java.lang.String fragment)
scan all methods for @Pact annotation and execute them, if not already initialized
fragment -