Skip to content

Commit

Permalink
test: use springboot test to verify pact broker values from spring co…
Browse files Browse the repository at this point in the history
…ntext #1051
  • Loading branch information
Ronald Holshausen committed Mar 21, 2020
1 parent 049ac1f commit 01d8235
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions provider/pact-jvm-provider-junit5-spring/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ dependencies {
implementation project(path: ":provider:pact-jvm-provider-junit5", configuration: 'default')
implementation 'org.springframework:spring-context:5.2.3.RELEASE'
implementation 'org.springframework:spring-test:5.2.3.RELEASE'

testImplementation 'org.springframework.boot:spring-boot-starter-test:2.2.5.RELEASE'
testImplementation 'org.springframework.boot:spring-boot-starter-web:2.2.5.RELEASE'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package au.com.dius.pact.provider.spring.junit5

import au.com.dius.pact.provider.junit.IgnoreNoPactsToVerify
import au.com.dius.pact.provider.junit.Provider
import au.com.dius.pact.provider.junit.loader.PactBroker
import au.com.dius.pact.provider.junit5.PactVerificationContext
import org.junit.jupiter.api.TestTemplate
import org.junit.jupiter.api.extension.ExtendWith
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.junit.jupiter.SpringExtension

@SpringBootApplication
open class TestApplication

@ExtendWith(SpringExtension::class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@Provider("Animal Profile Service")
@PactBroker
@IgnoreNoPactsToVerify
internal class PactVerificationSpringProviderTest {
@TestTemplate
@ExtendWith(PactVerificationSpringProvider::class)
fun pactVerificationTestTemplate(context: PactVerificationContext?) {
context?.verifyInteraction()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pactbroker:
host: localhost
port: ${local.server.port}

0 comments on commit 01d8235

Please sign in to comment.