au.com.dius.pact.provider.scalatest.package.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pact-jvm-provider-scalatest_2.11 Show documentation
Show all versions of pact-jvm-provider-scalatest_2.11 Show documentation
pact-jvm-provider-scalatest
========================
Provides an extension to scalatest to validate pact files against a running provider. See
[examples](src/test/scala/au/com/dius/pact/provider/scalatest)
for details.
*Note:* The Pact ProviderSpec requires scalatest 2.2.x
package au.com.dius.pact.provider
import java.net.URI
package object scalatest {
trait Consumer {
val filter: ConsumerInfo => Boolean
}
/**
* Matching consumer pacts will be allowed to run against the provider
*
* @param consumer
* @return
*/
implicit def strToConsumer(consumer: String) = new Consumer {
override val filter = (consumerInfo: ConsumerInfo) => consumerInfo.getName == consumer
}
/**
* @param provider which provider pact should be tested
* @param consumer which consumer pact should be tested
* @param uri where is the pact
*/
case class Pact(provider: String, consumer: Consumer, uri: URI)
case class ServerConfig(serverStarter: ServerStarter, restartServer: Boolean = false)
case class VerificationConfig(pact: Pact, serverConfig: ServerConfig)
}