-
-
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.
fix: Update RestPactRunner and MessagePactRunner to support V4 Pacts #…
- Loading branch information
1 parent
302013d
commit 3af6b08
Showing
7 changed files
with
93 additions
and
4 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
8 changes: 6 additions & 2 deletions
8
provider/junit/src/main/kotlin/au/com/dius/pact/provider/junit/MessagePactRunner.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 |
---|---|---|
@@ -1,17 +1,21 @@ | ||
package au.com.dius.pact.provider.junit | ||
|
||
import au.com.dius.pact.core.model.FilteredPact | ||
import au.com.dius.pact.core.model.Interaction | ||
import au.com.dius.pact.core.model.Pact | ||
import au.com.dius.pact.core.model.V4Pact | ||
import au.com.dius.pact.core.model.messaging.MessagePact | ||
import au.com.dius.pact.core.model.v4.V4InteractionType | ||
|
||
/** | ||
* Pact runner that only verifies message pacts | ||
*/ | ||
open class MessagePactRunner(clazz: Class<*>) : PactRunner(clazz) { | ||
override fun filterPacts(pacts: List<Pact>): List<Pact> { | ||
return super.filterPacts(pacts).filter { pact -> | ||
pact is MessagePact || (pact is FilteredPact && pact.pact is MessagePact) | ||
isMessagePact(pact) || (pact is FilteredPact && isMessagePact(pact.pact)) | ||
} | ||
} | ||
|
||
private fun isMessagePact(pact: Pact) = pact is MessagePact || | ||
(pact is V4Pact && pact.hasInteractionsOfType(V4InteractionType.AsynchronousMessages)) | ||
} |
1 change: 0 additions & 1 deletion
1
provider/junit/src/main/kotlin/au/com/dius/pact/provider/junit/PactRunner.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
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
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
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
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