@Provider("person_provider")// same as in the "provider_name" part in our pact file @PactFolder("target/pacts") // tells pact where to load the pact files from public class ExampleProviderTest {
protected ProviderInfo getProviderInfo(PactSource source) { Provider provider = testClass.getAnnotation(Provider.class); final ProviderInfo providerInfo = new ProviderInfo(provider.value()); providerInfo.setPort(port); providerInfo.setHost(host); providerInfo.setProtocol(protocol); providerInfo.setPath(path); providerInfo.setInsecure(insecure); if (testClass != null) { final List<FrameworkMethod> methods = testClass.getAnnotatedMethods(TargetRequestFilter.class); if (!methods.isEmpty()) { providerInfo.setRequestFilter((Consumer<HttpRequest>) httpRequest -> methods.forEach(method -> { try { method.invokeExplosively(testTarget, httpRequest); } catch (Throwable t) { throw new AssertionError("Request filter method " + method.getName() + " failed with an exception", t); } })); } } return providerInfo; } }
"server.port=8888" }) @Provider("userservice") @PactFolder("../pact-angular/pacts") public class UserControllerProviderTest {
@RunWith(PactRunner.class) @Provider("userservice") @PactFolder("../pact-message-consumer/target/pacts") public class UserCreatedMessageProviderTest {
@RunWith(PactRunner.class) @Provider("Our Provider") @PactBroker(host = "test.pact.dius.com.au", protocol = "https", port = "443", authentication = @PactBrokerAuth(username = "${pactBrokerUser}", password = "${pactBrokerPassword}")) public class PactVerificationTest { @ClassRule public static final DropwizardAppRule<ServiceConfig> RULE = new DropwizardAppRule<ServiceConfig>(MainApplication.class, ResourceHelpers.resourceFilePath("main-app-config.yaml")); @TestTarget public final Target target = new HttpTarget(8080); @State("data count > 0") public void dataCountGreaterThanZero() { DataStore.INSTANCE.setDataCount(1000); } @State("data count == 0") public void dataCountZero() { DataStore.INSTANCE.setDataCount(0); } }