-
-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: use springboot test to verify pact broker values from spring co…
…ntext #1051
- Loading branch information
Ronald Holshausen
committed
Mar 21, 2020
1 parent
049ac1f
commit 01d8235
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...test/kotlin/au/com/dius/pact/provider/spring/junit5/PactVerificationSpringProviderTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
provider/pact-jvm-provider-junit5-spring/src/test/resources/application.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pactbroker: | ||
host: localhost | ||
port: ${local.server.port} |