public class PactProviderRule
extends org.junit.rules.ExternalResource
PactVerification.
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.| Modifier and Type | Field and Description |
|---|---|
static au.com.dius.pact.consumer.VerificationResult |
PACT_VERIFIED |
| Constructor and Description |
|---|
PactProviderRule(java.lang.String provider,
java.lang.Object target)
Creates a mock provider by the given name.
|
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
|
| Modifier and Type | Method and Description |
|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
au.com.dius.pact.model.MockProviderConfig |
getConfig() |
protected java.util.Map<java.lang.String,au.com.dius.pact.model.PactFragment> |
getPacts()
scan all methods for @Pact annotation and execute them, if not already initialized
|
public PactProviderRule(java.lang.String provider,
java.lang.String host,
java.lang.Integer port,
java.lang.Object target)
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)
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)
apply in interface org.junit.rules.TestRuleapply in class org.junit.rules.ExternalResourceprotected java.util.Map<java.lang.String,au.com.dius.pact.model.PactFragment> getPacts()