Integrating with pact broker

This commit is contained in:
Ryan Harg 2023-01-02 14:01:50 +01:00
parent d82129fed0
commit 44d2871d3d
4 changed files with 20 additions and 5 deletions

View file

@ -2,6 +2,7 @@ plugins {
id "java"
id "org.springframework.boot" version "3.0.0"
id "io.spring.dependency-management" version "1.1.0"
id "au.com.dius.pact" version "4.4.2"
}
group = 'de.rpr'
@ -26,3 +27,21 @@ dependencies {
tasks.named('test') {
useJUnitPlatform()
}
pact {
publish {
// empty, but needs to be there
}
broker {
pactBrokerUrl = "http://localhost:9292"
}
serviceProviders {
UserServiceJUnit5 {
// empty
}
}
}

1
gradle.properties Normal file
View file

@ -0,0 +1 @@
pact.verifier.publishResults=true

View file

@ -1,14 +1,11 @@
package de.rpr.pactexample;
import au.com.dius.pact.consumer.MockServer;
import au.com.dius.pact.consumer.PactTestExecutionContext;
import au.com.dius.pact.consumer.dsl.PactBuilder;
import au.com.dius.pact.consumer.dsl.PactDslJsonArray;
import au.com.dius.pact.consumer.dsl.PactDslJsonBody;
import au.com.dius.pact.consumer.dsl.PactDslWithProvider;
import au.com.dius.pact.consumer.junit5.PactConsumerTestExt;
import au.com.dius.pact.consumer.junit5.PactTestFor;
import au.com.dius.pact.core.model.RequestResponsePact;
import au.com.dius.pact.core.model.V4Pact;
import au.com.dius.pact.core.model.annotations.Pact;
import org.junit.jupiter.api.Test;
@ -17,7 +14,6 @@ import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.web.client.RestTemplate;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;

View file

@ -18,7 +18,6 @@ import org.springframework.boot.test.web.server.LocalServerPort;
@PactBroker(url = "http://localhost:9292")
@SetSystemProperty.SetSystemProperties({
@SetSystemProperty(key = "pact.verifier.publishResults", value = "true"),
@SetSystemProperty(key = "pact.provider.version", value = "current")
})
public class PactProviderJUnit5WithBrokerTest {