Skip to content

Commit

Permalink
add scala helper to PactDslWithProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
jbwheatley committed Aug 2, 2021
1 parent 0e11778 commit 9092bf5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@

package pact4s

import au.com.dius.pact.consumer.dsl.{PactDslResponse, PactDslWithState}
import au.com.dius.pact.consumer.dsl.{PactDslResponse, PactDslWithProvider, PactDslWithState}

import scala.jdk.CollectionConverters._

object RequestResponsePactOpsForPlatform {
class PactDslWithProviderOps(val builder: PactDslWithProvider) extends AnyVal {
def `given`(state: String, params: Map[String, Any]): PactDslWithState =
builder.`given`(state, params.asJava)
}

class PactDslResponseOpsForPlatform(val builder: PactDslResponse) extends AnyVal {
def `given`(state: String, params: Map[String, Any]): PactDslWithState = builder.`given`(state, params.asJava)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@

package pact4s

import au.com.dius.pact.consumer.dsl.{PactDslResponse, PactDslWithState}
import au.com.dius.pact.consumer.dsl.{PactDslResponse, PactDslWithProvider, PactDslWithState}

import scala.jdk.CollectionConverters._

object RequestResponsePactOpsForPlatform {
class PactDslWithProviderOps(val builder: PactDslWithProvider) extends AnyVal {
def `given`(state: String, params: Map[String, Object]): PactDslWithState =
builder.`given`(state, params.asJava)
}

class PactDslResponseOpsForPlatform(val builder: PactDslResponse) extends AnyVal {
def `given`(state: String, params: Map[String, Object]): PactDslWithState =
builder.`given`(state, params.asJava)
Expand Down
2 changes: 2 additions & 0 deletions shared/src/main/scala/pact4s/RequestResponsePactOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ object RequestResponsePactOps {
}

trait RequestResponsePactOps {
implicit def toPactDslWithProviderOps(builder: PactDslWithProvider): PactDslWithProviderOps =
new PactDslWithProviderOps(builder)
implicit def toPactDslRequestWithPathOps(builder: PactDslRequestWithPath): PactDslRequestWithPathOps =
new PactDslRequestWithPathOps(builder)
implicit def toPactDslRequestWithoutPathOps(builder: PactDslRequestWithoutPath): PactDslRequestWithoutPathOps =
Expand Down

0 comments on commit 9092bf5

Please sign in to comment.