id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
id "io.freefair.lombok" version "5.2.1"
- id "au.com.dius.pact" version "4.2.0-beta.1"
+ id "au.com.dius.pact" version "4.2.2"
id "com.wiredforcode.spawn" version "0.8.2"
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-hateoas'
implementation 'com.jayway.jsonpath:json-path'
- implementation 'de.ingogriebsch.hateoas:spring-hateoas-siren:1.0.0-M2'
+ implementation 'de.ingogriebsch.hateoas:spring-hateoas-siren:1.0.0'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
+ testImplementation 'au.com.dius.pact.provider:junit5spring:4.2.2'
}
test {
package io.pactflow.example.sirenprovider;
-import org.junit.jupiter.api.Test;
+import au.com.dius.pact.provider.junit5.PactVerificationContext;
+import au.com.dius.pact.provider.junitsupport.Provider;
+import au.com.dius.pact.provider.junitsupport.loader.PactFolder;
+import au.com.dius.pact.provider.spring.junit5.PactVerificationSpringProvider;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.test.context.SpringBootTest;
-@SpringBootTest
-class SirenProviderApplicationTests {
+import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.DEFINED_PORT;
- @Test
- void contextLoads() {
- }
+@SpringBootTest(webEnvironment = DEFINED_PORT)
+@Provider("SirenOrderProvider")
+@PactFolder("../spring-consumer/target/pacts")
+class SirenProviderApplicationTests
+{
+ @TestTemplate
+ @ExtendWith(PactVerificationSpringProvider.class)
+ public void pactVerificationTestTemplate(PactVerificationContext context)
+ {
+ context.verifyInteraction();
+ }
}