Refactored functions to vals for a more idiomatic experience
This commit is contained in:
@@ -22,7 +22,7 @@ contract {
|
||||
request {
|
||||
method = PUT
|
||||
url = url("/frauds/name")
|
||||
body = body("name" to `$`(anyAlphaUnicode()))
|
||||
body = body("name" to value(anyAlphaUnicode))
|
||||
headers {
|
||||
contentType = "application/json"
|
||||
}
|
||||
|
||||
@@ -25,14 +25,14 @@ contract {
|
||||
url = url("/tests")
|
||||
multipart {
|
||||
field("file1", named(
|
||||
value(consumer(regex(nonEmpty())), producer("filename1")),
|
||||
value(consumer(regex(nonEmpty())), producer("content1"))))
|
||||
value(consumer(regex(nonEmpty)), producer("filename1")),
|
||||
value(consumer(regex(nonEmpty)), producer("content1"))))
|
||||
field("file2", named(
|
||||
value(consumer(regex(nonEmpty())), producer("filename2")),
|
||||
value(consumer(regex(nonEmpty())), producer("content2"))))
|
||||
value(consumer(regex(nonEmpty)), producer("filename2")),
|
||||
value(consumer(regex(nonEmpty)), producer("content2"))))
|
||||
field("test", named(
|
||||
value(consumer(regex(nonEmpty())), producer("filename3")),
|
||||
value(consumer(regex(nonEmpty())), producer(fileAsBytes("test.json"))),
|
||||
value(consumer(regex(nonEmpty)), producer("filename3")),
|
||||
value(consumer(regex(nonEmpty)), producer(fileAsBytes("test.json"))),
|
||||
value("application/json")))
|
||||
}
|
||||
headers {
|
||||
|
||||
@@ -25,14 +25,14 @@ contract {
|
||||
url = url("/tests")
|
||||
multipart {
|
||||
field("file1", named(
|
||||
value(consumer(regex(nonEmpty())), producer("filename1")),
|
||||
value(consumer(regex(nonEmpty())), producer("content1"))))
|
||||
value(consumer(regex(nonEmpty)), producer("filename1")),
|
||||
value(consumer(regex(nonEmpty)), producer("content1"))))
|
||||
field("file2", named(
|
||||
value(consumer(regex(nonEmpty())), producer("filename2")),
|
||||
value(consumer(regex(nonEmpty())), producer("content2"))))
|
||||
value(consumer(regex(nonEmpty)), producer("filename2")),
|
||||
value(consumer(regex(nonEmpty)), producer("content2"))))
|
||||
field("test", named(
|
||||
value(consumer(regex(nonEmpty())), producer("filename3")),
|
||||
value(consumer(regex(nonEmpty())), producer(file("test.json"))),
|
||||
value(consumer(regex(nonEmpty)), producer("filename3")),
|
||||
value(consumer(regex(nonEmpty)), producer(file("test.json"))),
|
||||
value("application/json")))
|
||||
}
|
||||
headers {
|
||||
|
||||
@@ -46,20 +46,28 @@ open class BodyMatchersDsl {
|
||||
this.xPathMatchers[path] = matcher
|
||||
}
|
||||
|
||||
fun byDate() = MatchingTypeValue(MatchingType.DATE, RegexPatterns.isoDate())
|
||||
/* HELPER VARIABLES */
|
||||
|
||||
fun byTime() = MatchingTypeValue(MatchingType.TIME, RegexPatterns.isoTime())
|
||||
val byDate
|
||||
get() = MatchingTypeValue(MatchingType.DATE, RegexPatterns.isoDate())
|
||||
|
||||
fun byTimestamp() = MatchingTypeValue(MatchingType.TIMESTAMP, RegexPatterns.isoDateTime())
|
||||
val byTime
|
||||
get() = MatchingTypeValue(MatchingType.TIME, RegexPatterns.isoTime())
|
||||
|
||||
fun byRegex(regex: String)= byRegex(Pattern.compile(regex))
|
||||
val byTimestamp
|
||||
get() = MatchingTypeValue(MatchingType.TIMESTAMP, RegexPatterns.isoDateTime())
|
||||
|
||||
val byEquality
|
||||
get() = MatchingTypeValue(MatchingType.EQUALITY)
|
||||
|
||||
/* HELPER FUNCTIONS */
|
||||
|
||||
fun byRegex(regex: String) = byRegex(Pattern.compile(regex))
|
||||
|
||||
fun byRegex(regex: RegexProperty) = RegexMatchingTypeValue(MatchingType.REGEX, regex)
|
||||
|
||||
fun byRegex(regex: Pattern) = RegexMatchingTypeValue(MatchingType.REGEX, RegexProperty(regex))
|
||||
|
||||
fun byEquality() = MatchingTypeValue(MatchingType.EQUALITY)
|
||||
|
||||
fun byType(configurer: MatchingTypeValueHolder.() -> Unit): MatchingTypeValue = MatchingTypeValueHolder().apply(configurer).matchingTypeValue
|
||||
|
||||
internal open fun get(): BodyMatchers = configureBodyMatchers(BodyMatchers())
|
||||
|
||||
@@ -26,6 +26,67 @@ import java.util.regex.Pattern
|
||||
*/
|
||||
open class CommonDsl {
|
||||
|
||||
/* HELPER VARIABLES */
|
||||
|
||||
/* REGEX */
|
||||
|
||||
val onlyAlphaUnicode: RegexProperty
|
||||
get() = RegexPatterns.onlyAlphaUnicode()
|
||||
|
||||
val alphaNumeric: RegexProperty
|
||||
get() = RegexPatterns.alphaNumeric()
|
||||
|
||||
val number: RegexProperty
|
||||
get() = RegexPatterns.number()
|
||||
|
||||
val positiveInt: RegexProperty
|
||||
get() = RegexPatterns.positiveInt()
|
||||
|
||||
val anyBoolean: RegexProperty
|
||||
get() = RegexPatterns.anyBoolean()
|
||||
|
||||
val anInteger: RegexProperty
|
||||
get() = RegexPatterns.anInteger()
|
||||
|
||||
val aDouble: RegexProperty
|
||||
get() = RegexPatterns.aDouble()
|
||||
|
||||
val ipAddress: RegexProperty
|
||||
get() = RegexPatterns.ipAddress()
|
||||
|
||||
val hostname: RegexProperty
|
||||
get() = RegexPatterns.hostname()
|
||||
|
||||
val email: RegexProperty
|
||||
get() = RegexPatterns.email()
|
||||
|
||||
val anUrl: RegexProperty
|
||||
get() = RegexPatterns.url()
|
||||
|
||||
val anHttpsUrl: RegexProperty
|
||||
get() = RegexPatterns.httpsUrl()
|
||||
|
||||
val uuid: RegexProperty
|
||||
get() = RegexPatterns.uuid()
|
||||
|
||||
val isoDate: RegexProperty
|
||||
get() = RegexPatterns.isoDate()
|
||||
|
||||
val isoDateTime: RegexProperty
|
||||
get() = RegexPatterns.isoDateTime()
|
||||
|
||||
val isoTime: RegexProperty
|
||||
get() = RegexPatterns.isoTime()
|
||||
|
||||
val iso8601WithOffset: RegexProperty
|
||||
get() = RegexPatterns.iso8601WithOffset()
|
||||
|
||||
val nonEmpty: RegexProperty
|
||||
get() = RegexPatterns.nonEmpty()
|
||||
|
||||
val nonBlank: RegexProperty
|
||||
get() = RegexPatterns.nonBlank()
|
||||
|
||||
/* HELPER FUNCTIONS */
|
||||
|
||||
/**
|
||||
@@ -137,8 +198,8 @@ open class CommonDsl {
|
||||
contentType: DslProperty<Any>) = NamedProperty(name, value, contentType)
|
||||
|
||||
fun named(namedMap: Map<String, DslProperty<Any>>) = NamedProperty(namedMap)
|
||||
|
||||
/* REGEX */
|
||||
|
||||
/* REGEX FUNCTIONS */
|
||||
|
||||
fun regexProperty(value: Any) = RegexProperty(value)
|
||||
|
||||
@@ -147,42 +208,4 @@ open class CommonDsl {
|
||||
fun regex(regex: Pattern) = regexProperty(regex)
|
||||
|
||||
fun regex(regex: RegexProperty) = regex
|
||||
|
||||
fun onlyAlphaUnicode(): RegexProperty = RegexPatterns.onlyAlphaUnicode()
|
||||
|
||||
fun alphaNumeric(): RegexProperty = RegexPatterns.alphaNumeric()
|
||||
|
||||
fun number(): RegexProperty = RegexPatterns.number()
|
||||
|
||||
fun positiveInt(): RegexProperty = RegexPatterns.positiveInt()
|
||||
|
||||
fun anyBoolean(): RegexProperty = RegexPatterns.anyBoolean()
|
||||
|
||||
fun anInteger(): RegexProperty = RegexPatterns.anInteger()
|
||||
|
||||
fun aDouble(): RegexProperty = RegexPatterns.aDouble()
|
||||
|
||||
fun ipAddress(): RegexProperty = RegexPatterns.ipAddress()
|
||||
|
||||
fun hostname(): RegexProperty = RegexPatterns.hostname()
|
||||
|
||||
fun email(): RegexProperty = RegexPatterns.email()
|
||||
|
||||
fun url(): RegexProperty = RegexPatterns.url()
|
||||
|
||||
fun httpsUrl(): RegexProperty = RegexPatterns.httpsUrl()
|
||||
|
||||
fun uuid(): RegexProperty = RegexPatterns.uuid()
|
||||
|
||||
fun isoDate(): RegexProperty = RegexPatterns.isoDate()
|
||||
|
||||
fun isoDateTime(): RegexProperty = RegexPatterns.isoDateTime()
|
||||
|
||||
fun isoTime(): RegexProperty = RegexPatterns.isoTime()
|
||||
|
||||
fun iso8601WithOffset(): RegexProperty = RegexPatterns.iso8601WithOffset()
|
||||
|
||||
fun nonEmpty(): RegexProperty = RegexPatterns.nonEmpty()
|
||||
|
||||
fun nonBlank(): RegexProperty = RegexPatterns.nonBlank()
|
||||
}
|
||||
@@ -22,7 +22,7 @@ import org.springframework.cloud.contract.spec.toDslProperty
|
||||
* @author Tim Ysewyn
|
||||
*/
|
||||
@ContractDslMarker
|
||||
class InputDsl : CommonDsl(), RegexCreatingProperty<ClientDslProperty> {
|
||||
class InputDsl : CommonDsl() {
|
||||
|
||||
private val delegate = Input()
|
||||
|
||||
@@ -49,47 +49,71 @@ class InputDsl : CommonDsl(), RegexCreatingProperty<ClientDslProperty> {
|
||||
this.bodyMatchers = BodyMatchersDsl().apply(configurer).get()
|
||||
}
|
||||
|
||||
override fun anyAlphaUnicode(): ClientDslProperty = delegate.anyAlphaUnicode()
|
||||
/* HELPER VARIABLES */
|
||||
|
||||
override fun anyAlphaNumeric(): ClientDslProperty = delegate.anyAlphaNumeric()
|
||||
val anyAlphaUnicode: ClientDslProperty
|
||||
get() = delegate.anyAlphaUnicode()
|
||||
|
||||
override fun anyNumber(): ClientDslProperty = delegate.anyNumber()
|
||||
val anyAlphaNumeric: ClientDslProperty
|
||||
get() = delegate.anyAlphaNumeric()
|
||||
|
||||
override fun anyInteger(): ClientDslProperty = delegate.anyInteger()
|
||||
val anyNumber: ClientDslProperty
|
||||
get() = delegate.anyNumber()
|
||||
|
||||
override fun anyPositiveInt(): ClientDslProperty = delegate.anyPositiveInt()
|
||||
val anyInteger: ClientDslProperty
|
||||
get() = delegate.anyInteger()
|
||||
|
||||
override fun anyDouble(): ClientDslProperty = delegate.anyDouble()
|
||||
val anyPositiveInt: ClientDslProperty
|
||||
get() = delegate.anyPositiveInt()
|
||||
|
||||
override fun anyHex(): ClientDslProperty = delegate.anyHex()
|
||||
val anyDouble: ClientDslProperty
|
||||
get() = delegate.anyDouble()
|
||||
|
||||
override fun aBoolean(): ClientDslProperty = delegate.aBoolean()
|
||||
val anyHex: ClientDslProperty
|
||||
get() = delegate.anyHex()
|
||||
|
||||
override fun anyIpAddress(): ClientDslProperty = delegate.anyIpAddress()
|
||||
val aBoolean: ClientDslProperty
|
||||
get() = delegate.aBoolean()
|
||||
|
||||
override fun anyHostname(): ClientDslProperty = delegate.anyHostname()
|
||||
val anyIpAddress: ClientDslProperty
|
||||
get() = delegate.anyIpAddress()
|
||||
|
||||
override fun anyEmail(): ClientDslProperty = delegate.anyEmail()
|
||||
val anyHostname: ClientDslProperty
|
||||
get() = delegate.anyHostname()
|
||||
|
||||
override fun anyUrl(): ClientDslProperty = delegate.anyUrl()
|
||||
val anyEmail: ClientDslProperty
|
||||
get() = delegate.anyEmail()
|
||||
|
||||
override fun anyHttpsUrl(): ClientDslProperty = delegate.anyHttpsUrl()
|
||||
val anyUrl: ClientDslProperty
|
||||
get() = delegate.anyUrl()
|
||||
|
||||
override fun anyUuid(): ClientDslProperty = delegate.anyUuid()
|
||||
val anyHttpsUrl: ClientDslProperty
|
||||
get() = delegate.anyHttpsUrl()
|
||||
|
||||
override fun anyDate(): ClientDslProperty = delegate.anyDate()
|
||||
val anyUuid: ClientDslProperty
|
||||
get() = delegate.anyUuid()
|
||||
|
||||
override fun anyDateTime(): ClientDslProperty = delegate.anyDateTime()
|
||||
val anyDate: ClientDslProperty
|
||||
get() = delegate.anyDate()
|
||||
|
||||
override fun anyTime(): ClientDslProperty = delegate.anyTime()
|
||||
val anyDateTime: ClientDslProperty
|
||||
get() = delegate.anyDateTime()
|
||||
|
||||
override fun anyIso8601WithOffset(): ClientDslProperty = delegate.anyIso8601WithOffset()
|
||||
val anyTime: ClientDslProperty
|
||||
get() = delegate.anyTime()
|
||||
|
||||
override fun anyNonBlankString(): ClientDslProperty = delegate.anyNonBlankString()
|
||||
val anyIso8601WithOffset: ClientDslProperty
|
||||
get() = delegate.anyIso8601WithOffset()
|
||||
|
||||
override fun anyNonEmptyString(): ClientDslProperty = delegate.anyNonEmptyString()
|
||||
val anyNonBlankString: ClientDslProperty
|
||||
get() = delegate.anyNonBlankString()
|
||||
|
||||
override fun anyOf(vararg values: String?): ClientDslProperty = delegate.anyOf(*values)
|
||||
val anyNonEmptyString: ClientDslProperty
|
||||
get() = delegate.anyNonEmptyString()
|
||||
|
||||
/* HELPER FUNCTIONS */
|
||||
|
||||
fun anyOf(vararg values: String?) = delegate.anyOf(*values)
|
||||
|
||||
internal fun get(): Input {
|
||||
val input = Input()
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.cloud.contract.spec.toDslProperty
|
||||
* @author Tim Ysewyn
|
||||
*/
|
||||
@ContractDslMarker
|
||||
class OutputMessageDsl : CommonDsl(), RegexCreatingProperty<ServerDslProperty> {
|
||||
class OutputMessageDsl : CommonDsl() {
|
||||
|
||||
private val delegate = OutputMessage()
|
||||
|
||||
@@ -44,47 +44,71 @@ class OutputMessageDsl : CommonDsl(), RegexCreatingProperty<ServerDslProperty> {
|
||||
this.bodyMatchers = ResponseBodyMatchersDsl().apply(configurer).get()
|
||||
}
|
||||
|
||||
override fun anyAlphaUnicode(): ServerDslProperty = delegate.anyAlphaUnicode()
|
||||
/* HELPER VARIABLES */
|
||||
|
||||
override fun anyAlphaNumeric(): ServerDslProperty = delegate.anyAlphaNumeric()
|
||||
val anyAlphaUnicode: ServerDslProperty
|
||||
get() = delegate.anyAlphaUnicode()
|
||||
|
||||
override fun anyNumber(): ServerDslProperty = delegate.anyNumber()
|
||||
val anyAlphaNumeric: ServerDslProperty
|
||||
get() = delegate.anyAlphaNumeric()
|
||||
|
||||
override fun anyInteger(): ServerDslProperty = delegate.anyInteger()
|
||||
val anyNumber: ServerDslProperty
|
||||
get() = delegate.anyNumber()
|
||||
|
||||
override fun anyPositiveInt(): ServerDslProperty = delegate.anyPositiveInt()
|
||||
val anyInteger: ServerDslProperty
|
||||
get() = delegate.anyInteger()
|
||||
|
||||
override fun anyDouble(): ServerDslProperty = delegate.anyDouble()
|
||||
val anyPositiveInt: ServerDslProperty
|
||||
get() = delegate.anyPositiveInt()
|
||||
|
||||
override fun anyHex(): ServerDslProperty = delegate.anyHex()
|
||||
val anyDouble: ServerDslProperty
|
||||
get() = delegate.anyDouble()
|
||||
|
||||
override fun aBoolean(): ServerDslProperty = delegate.aBoolean()
|
||||
val anyHex: ServerDslProperty
|
||||
get() = delegate.anyHex()
|
||||
|
||||
override fun anyIpAddress(): ServerDslProperty = delegate.anyIpAddress()
|
||||
val aBoolean: ServerDslProperty
|
||||
get() = delegate.aBoolean()
|
||||
|
||||
override fun anyHostname(): ServerDslProperty = delegate.anyHostname()
|
||||
val anyIpAddress: ServerDslProperty
|
||||
get() = delegate.anyIpAddress()
|
||||
|
||||
override fun anyEmail(): ServerDslProperty = delegate.anyEmail()
|
||||
val anyHostname: ServerDslProperty
|
||||
get() = delegate.anyHostname()
|
||||
|
||||
override fun anyUrl(): ServerDslProperty = delegate.anyUrl()
|
||||
val anyEmail: ServerDslProperty
|
||||
get() = delegate.anyEmail()
|
||||
|
||||
override fun anyHttpsUrl(): ServerDslProperty = delegate.anyHttpsUrl()
|
||||
val anyUrl: ServerDslProperty
|
||||
get() = delegate.anyUrl()
|
||||
|
||||
override fun anyUuid(): ServerDslProperty = delegate.anyUuid()
|
||||
val anyHttpsUrl: ServerDslProperty
|
||||
get() = delegate.anyHttpsUrl()
|
||||
|
||||
override fun anyDate(): ServerDslProperty = delegate.anyDate()
|
||||
val anyUuid: ServerDslProperty
|
||||
get() = delegate.anyUuid()
|
||||
|
||||
override fun anyDateTime(): ServerDslProperty = delegate.anyDateTime()
|
||||
val anyDate: ServerDslProperty
|
||||
get() = delegate.anyDate()
|
||||
|
||||
override fun anyTime(): ServerDslProperty = delegate.anyTime()
|
||||
val anyDateTime: ServerDslProperty
|
||||
get() = delegate.anyDateTime()
|
||||
|
||||
override fun anyIso8601WithOffset(): ServerDslProperty = delegate.anyIso8601WithOffset()
|
||||
val anyTime: ServerDslProperty
|
||||
get() = delegate.anyTime()
|
||||
|
||||
override fun anyNonBlankString(): ServerDslProperty = delegate.anyNonBlankString()
|
||||
val anyIso8601WithOffset: ServerDslProperty
|
||||
get() = delegate.anyIso8601WithOffset()
|
||||
|
||||
override fun anyNonEmptyString(): ServerDslProperty = delegate.anyNonEmptyString()
|
||||
val anyNonBlankString: ServerDslProperty
|
||||
get() = delegate.anyNonBlankString()
|
||||
|
||||
override fun anyOf(vararg values: String?): ServerDslProperty = delegate.anyOf(*values)
|
||||
val anyNonEmptyString: ServerDslProperty
|
||||
get() = delegate.anyNonEmptyString()
|
||||
|
||||
/* HELPER FUNCTIONS */
|
||||
|
||||
fun anyOf(vararg values: String?) = delegate.anyOf(*values)
|
||||
|
||||
internal fun get(): OutputMessage {
|
||||
val outputMessage = OutputMessage()
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.regex.Pattern
|
||||
* @author Tim Ysewyn
|
||||
*/
|
||||
@ContractDslMarker
|
||||
open class RequestDsl : CommonDsl(), RegexCreatingProperty<ClientDslProperty> {
|
||||
open class RequestDsl : CommonDsl() {
|
||||
|
||||
private val delegate = Request()
|
||||
|
||||
@@ -80,21 +80,91 @@ open class RequestDsl : CommonDsl(), RegexCreatingProperty<ClientDslProperty> {
|
||||
|
||||
/* HTTP METHODS */
|
||||
|
||||
val GET = method(HttpMethods.GET)
|
||||
val GET: DslProperty<String>
|
||||
get() = method(HttpMethods.GET)
|
||||
|
||||
val HEAD = method(HttpMethods.HEAD)
|
||||
val HEAD: DslProperty<String>
|
||||
get() = method(HttpMethods.HEAD)
|
||||
|
||||
val POST = method(HttpMethods.POST)
|
||||
val POST: DslProperty<String>
|
||||
get() = method(HttpMethods.POST)
|
||||
|
||||
val PUT = method(HttpMethods.PUT)
|
||||
val PUT: DslProperty<String>
|
||||
get() = method(HttpMethods.PUT)
|
||||
|
||||
val PATCH = method(HttpMethods.PATCH)
|
||||
val PATCH: DslProperty<String>
|
||||
get() = method(HttpMethods.PATCH)
|
||||
|
||||
val DELETE = method(HttpMethods.DELETE)
|
||||
val DELETE: DslProperty<String>
|
||||
get() = method(HttpMethods.DELETE)
|
||||
|
||||
val OPTIONS = method(HttpMethods.OPTIONS)
|
||||
val OPTIONS: DslProperty<String>
|
||||
get() = method(HttpMethods.OPTIONS)
|
||||
|
||||
val TRACE = method(HttpMethods.TRACE)
|
||||
val TRACE: DslProperty<String>
|
||||
get() = method(HttpMethods.TRACE)
|
||||
|
||||
/* REGEX */
|
||||
|
||||
val anyAlphaUnicode: ClientDslProperty
|
||||
get() = delegate.anyAlphaUnicode()
|
||||
|
||||
val anyAlphaNumeric: ClientDslProperty
|
||||
get() = delegate.anyAlphaNumeric()
|
||||
|
||||
val anyNumber: ClientDslProperty
|
||||
get() = delegate.anyNumber()
|
||||
|
||||
val anyInteger: ClientDslProperty
|
||||
get() = delegate.anyInteger()
|
||||
|
||||
val anyPositiveInt: ClientDslProperty
|
||||
get() = delegate.anyPositiveInt()
|
||||
|
||||
val anyDouble: ClientDslProperty
|
||||
get() = delegate.anyDouble()
|
||||
|
||||
val anyHex: ClientDslProperty
|
||||
get() = delegate.anyHex()
|
||||
|
||||
val aBoolean: ClientDslProperty
|
||||
get() = delegate.aBoolean()
|
||||
|
||||
val anyIpAddress: ClientDslProperty
|
||||
get() = delegate.anyIpAddress()
|
||||
|
||||
val anyHostname: ClientDslProperty
|
||||
get() = delegate.anyHostname()
|
||||
|
||||
val anyEmail: ClientDslProperty
|
||||
get() = delegate.anyEmail()
|
||||
|
||||
val anyUrl: ClientDslProperty
|
||||
get() = delegate.anyUrl()
|
||||
|
||||
val anyHttpsUrl: ClientDslProperty
|
||||
get() = delegate.anyHttpsUrl()
|
||||
|
||||
val anyUuid: ClientDslProperty
|
||||
get() = delegate.anyUuid()
|
||||
|
||||
val anyDate: ClientDslProperty
|
||||
get() = delegate.anyDate()
|
||||
|
||||
val anyDateTime: ClientDslProperty
|
||||
get() = delegate.anyDateTime()
|
||||
|
||||
val anyTime: ClientDslProperty
|
||||
get() = delegate.anyTime()
|
||||
|
||||
val anyIso8601WithOffset: ClientDslProperty
|
||||
get() = delegate.anyIso8601WithOffset()
|
||||
|
||||
val anyNonBlankString: ClientDslProperty
|
||||
get() = delegate.anyNonBlankString()
|
||||
|
||||
val anyNonEmptyString: ClientDslProperty
|
||||
get() = delegate.anyNonEmptyString()
|
||||
|
||||
/* HELPER FUNCTIONS */
|
||||
|
||||
@@ -146,89 +216,35 @@ open class RequestDsl : CommonDsl(), RegexCreatingProperty<ClientDslProperty> {
|
||||
*/
|
||||
fun absent() = MatchingStrategy(true, MatchingStrategy.Type.ABSENT)
|
||||
|
||||
fun value(value: ClientDslProperty) = delegate.value(value)
|
||||
fun value(value: ClientDslProperty): DslProperty<Any> = delegate.value(value)
|
||||
|
||||
fun v(value: ClientDslProperty) = delegate.value(value)
|
||||
fun v(value: ClientDslProperty): DslProperty<Any> = delegate.value(value)
|
||||
|
||||
fun `$`(value: ClientDslProperty) = delegate.value(value)
|
||||
fun value(value: DslProperty<Any>): DslProperty<Any> = delegate.value(value)
|
||||
|
||||
fun value(value: DslProperty<Any>) = delegate.value(value)
|
||||
fun v(value: DslProperty<Any>): DslProperty<Any> = delegate.value(value)
|
||||
|
||||
fun v(value: DslProperty<Any>) = delegate.value(value)
|
||||
fun value(value: Pattern): DslProperty<Any> = delegate.value(value)
|
||||
|
||||
fun `$`(value: DslProperty<Any>) = delegate.value(value)
|
||||
fun v(value: Pattern): DslProperty<Any> = delegate.value(value)
|
||||
|
||||
fun value(value: Pattern) = delegate.value(value)
|
||||
fun value(value: RegexProperty): DslProperty<Any> = delegate.value(value)
|
||||
|
||||
fun v(value: Pattern) = delegate.value(value)
|
||||
fun v(value: RegexProperty): DslProperty<Any> = delegate.value(value)
|
||||
|
||||
fun `$`(value: Pattern) = delegate.value(value)
|
||||
fun value(value: Any?): DslProperty<Any> = delegate.value(value)
|
||||
|
||||
fun value(value: RegexProperty) = delegate.value(value)
|
||||
fun v(value: Any?): DslProperty<Any> = delegate.value(value)
|
||||
|
||||
fun v(value: RegexProperty) = delegate.value(value)
|
||||
fun value(client: ClientDslProperty, server: ServerDslProperty): DslProperty<Any> = delegate.value(client, server)
|
||||
|
||||
fun `$`(value: RegexProperty) = delegate.value(value)
|
||||
fun v(client: ClientDslProperty, server: ServerDslProperty): DslProperty<Any> = delegate.value(client, server)
|
||||
|
||||
fun value(value: Any?) = delegate.value(value)
|
||||
fun value(server: ServerDslProperty, client: ClientDslProperty): DslProperty<Any> = delegate.value(client, server)
|
||||
|
||||
fun v(value: Any?) = delegate.value(value)
|
||||
fun v(server: ServerDslProperty, client: ClientDslProperty): DslProperty<Any> = delegate.value(client, server)
|
||||
|
||||
fun `$`(value: Any?) = delegate.value(value)
|
||||
|
||||
fun value(client: ClientDslProperty, server: ServerDslProperty) = delegate.value(client, server)
|
||||
|
||||
fun v(client: ClientDslProperty, server: ServerDslProperty) = delegate.value(client, server)
|
||||
|
||||
fun `$`(client: ClientDslProperty, server: ServerDslProperty) = delegate.value(client, server)
|
||||
|
||||
fun value(server: ServerDslProperty, client: ClientDslProperty) = delegate.value(client, server)
|
||||
|
||||
fun v(server: ServerDslProperty, client: ClientDslProperty) = delegate.value(client, server)
|
||||
|
||||
fun `$`(server: ServerDslProperty, client: ClientDslProperty) = delegate.value(client, server)
|
||||
|
||||
override fun anyAlphaUnicode() = delegate.anyAlphaUnicode()
|
||||
|
||||
override fun anyAlphaNumeric() = delegate.anyAlphaNumeric()
|
||||
|
||||
override fun anyNumber() = delegate.anyNumber()
|
||||
|
||||
override fun anyInteger() = delegate.anyInteger()
|
||||
|
||||
override fun anyPositiveInt() = delegate.anyPositiveInt()
|
||||
|
||||
override fun anyDouble() = delegate.anyDouble()
|
||||
|
||||
override fun anyHex() = delegate.anyHex()
|
||||
|
||||
override fun aBoolean() = delegate.aBoolean()
|
||||
|
||||
override fun anyIpAddress() = delegate.anyIpAddress()
|
||||
|
||||
override fun anyHostname() = delegate.anyHostname()
|
||||
|
||||
override fun anyEmail() = delegate.anyEmail()
|
||||
|
||||
override fun anyUrl() = delegate.anyUrl()
|
||||
|
||||
override fun anyHttpsUrl() = delegate.anyHttpsUrl()
|
||||
|
||||
override fun anyUuid() = delegate.anyUuid()
|
||||
|
||||
override fun anyDate() = delegate.anyDate()
|
||||
|
||||
override fun anyDateTime() = delegate.anyDateTime()
|
||||
|
||||
override fun anyTime() = delegate.anyTime()
|
||||
|
||||
override fun anyIso8601WithOffset() = delegate.anyIso8601WithOffset()
|
||||
|
||||
override fun anyNonBlankString() = delegate.anyNonBlankString()
|
||||
|
||||
override fun anyNonEmptyString() = delegate.anyNonEmptyString()
|
||||
|
||||
override fun anyOf(vararg values: String?) = delegate.anyOf(*values)
|
||||
fun anyOf(vararg values: String?): ClientDslProperty = delegate.anyOf(*values)
|
||||
|
||||
internal fun get(): Request {
|
||||
val request = Request()
|
||||
|
||||
@@ -21,9 +21,11 @@ package org.springframework.cloud.contract.spec.internal
|
||||
*/
|
||||
class ResponseBodyMatchersDsl: BodyMatchersDsl() {
|
||||
|
||||
fun byType() = MatchingTypeValue(MatchingType.TYPE)
|
||||
val byType
|
||||
get() = MatchingTypeValue(MatchingType.TYPE)
|
||||
|
||||
fun byNull() = MatchingTypeValue(MatchingType.NULL)
|
||||
val byNull
|
||||
get() = MatchingTypeValue(MatchingType.NULL)
|
||||
|
||||
fun byCommand(execute: String) = MatchingTypeValue().apply {
|
||||
type = MatchingType.COMMAND
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.regex.Pattern
|
||||
* @author Tim Ysewyn
|
||||
*/
|
||||
@ContractDslMarker
|
||||
class ResponseDsl : CommonDsl(), RegexCreatingProperty<ServerDslProperty> {
|
||||
class ResponseDsl : CommonDsl() {
|
||||
|
||||
private val delegate = Response()
|
||||
|
||||
@@ -67,123 +67,244 @@ class ResponseDsl : CommonDsl(), RegexCreatingProperty<ServerDslProperty> {
|
||||
|
||||
/* HTTP STATUS CODES */
|
||||
|
||||
val CONTINUE = code(HttpStatus.CONTINUE)
|
||||
val CONTINUE
|
||||
get() = code(HttpStatus.CONTINUE)
|
||||
|
||||
val SWITCHING_PROTOCOLS = code(HttpStatus.SWITCHING_PROTOCOLS)
|
||||
val SWITCHING_PROTOCOLS
|
||||
get() = code(HttpStatus.SWITCHING_PROTOCOLS)
|
||||
|
||||
val PROCESSING = code(HttpStatus.PROCESSING)
|
||||
val PROCESSING
|
||||
get() = code(HttpStatus.PROCESSING)
|
||||
|
||||
val CHECKPOINT = code(HttpStatus.CHECKPOINT)
|
||||
val CHECKPOINT
|
||||
get() = code(HttpStatus.CHECKPOINT)
|
||||
|
||||
val OK = code(HttpStatus.OK)
|
||||
val OK
|
||||
get() = code(HttpStatus.OK)
|
||||
|
||||
val CREATED = code(HttpStatus.CREATED)
|
||||
val CREATED
|
||||
get() = code(HttpStatus.CREATED)
|
||||
|
||||
val ACCEPTED = code(HttpStatus.ACCEPTED)
|
||||
val ACCEPTED
|
||||
get() = code(HttpStatus.ACCEPTED)
|
||||
|
||||
val NON_AUTHORITATIVE_INFORMATION = code(HttpStatus.NON_AUTHORITATIVE_INFORMATION)
|
||||
val NON_AUTHORITATIVE_INFORMATION
|
||||
get() = code(HttpStatus.NON_AUTHORITATIVE_INFORMATION)
|
||||
|
||||
val NO_CONTENT = code(HttpStatus.NO_CONTENT)
|
||||
val NO_CONTENT
|
||||
get() = code(HttpStatus.NO_CONTENT)
|
||||
|
||||
val RESET_CONTENT = code(HttpStatus.RESET_CONTENT)
|
||||
val RESET_CONTENT
|
||||
get() = code(HttpStatus.RESET_CONTENT)
|
||||
|
||||
val PARTIAL_CONTENT = code(HttpStatus.PARTIAL_CONTENT)
|
||||
val PARTIAL_CONTENT
|
||||
get() = code(HttpStatus.PARTIAL_CONTENT)
|
||||
|
||||
val MULTI_STATUS = code(HttpStatus.MULTI_STATUS)
|
||||
val MULTI_STATUS
|
||||
get() = code(HttpStatus.MULTI_STATUS)
|
||||
|
||||
val ALREADY_REPORTED = code(HttpStatus.ALREADY_REPORTED)
|
||||
val ALREADY_REPORTED
|
||||
get() = code(HttpStatus.ALREADY_REPORTED)
|
||||
|
||||
val IM_USED = code(HttpStatus.IM_USED)
|
||||
val IM_USED
|
||||
get() = code(HttpStatus.IM_USED)
|
||||
|
||||
val MULTIPLE_CHOICES = code(HttpStatus.MULTIPLE_CHOICES)
|
||||
val MULTIPLE_CHOICES
|
||||
get() = code(HttpStatus.MULTIPLE_CHOICES)
|
||||
|
||||
val MOVED_PERMANENTLY = code(HttpStatus.MOVED_PERMANENTLY)
|
||||
val MOVED_PERMANENTLY
|
||||
get() = code(HttpStatus.MOVED_PERMANENTLY)
|
||||
|
||||
val FOUND = code(HttpStatus.FOUND)
|
||||
val FOUND
|
||||
get() = code(HttpStatus.FOUND)
|
||||
|
||||
val SEE_OTHER = code(HttpStatus.SEE_OTHER)
|
||||
val SEE_OTHER
|
||||
get() = code(HttpStatus.SEE_OTHER)
|
||||
|
||||
val NOT_MODIFIED = code(HttpStatus.NOT_MODIFIED)
|
||||
val NOT_MODIFIED
|
||||
get() = code(HttpStatus.NOT_MODIFIED)
|
||||
|
||||
val TEMPORARY_REDIRECT = code(HttpStatus.TEMPORARY_REDIRECT)
|
||||
val TEMPORARY_REDIRECT
|
||||
get() = code(HttpStatus.TEMPORARY_REDIRECT)
|
||||
|
||||
val PERMANENT_REDIRECT = code(HttpStatus.PERMANENT_REDIRECT)
|
||||
val PERMANENT_REDIRECT
|
||||
get() = code(HttpStatus.PERMANENT_REDIRECT)
|
||||
|
||||
val BAD_REQUEST = code(HttpStatus.BAD_REQUEST)
|
||||
val BAD_REQUEST
|
||||
get() = code(HttpStatus.BAD_REQUEST)
|
||||
|
||||
val UNAUTHORIZED = code(HttpStatus.UNAUTHORIZED)
|
||||
val UNAUTHORIZED
|
||||
get() = code(HttpStatus.UNAUTHORIZED)
|
||||
|
||||
val PAYMENT_REQUIRED = code(HttpStatus.PAYMENT_REQUIRED)
|
||||
val PAYMENT_REQUIRED
|
||||
get() = code(HttpStatus.PAYMENT_REQUIRED)
|
||||
|
||||
val FORBIDDEN = code(HttpStatus.FORBIDDEN)
|
||||
val FORBIDDEN
|
||||
get() = code(HttpStatus.FORBIDDEN)
|
||||
|
||||
val NOT_FOUND = code(HttpStatus.NOT_FOUND)
|
||||
val NOT_FOUND
|
||||
get() = code(HttpStatus.NOT_FOUND)
|
||||
|
||||
val METHOD_NOT_ALLOWED = code(HttpStatus.METHOD_NOT_ALLOWED)
|
||||
val METHOD_NOT_ALLOWED
|
||||
get() = code(HttpStatus.METHOD_NOT_ALLOWED)
|
||||
|
||||
val NOT_ACCEPTABLE = code(HttpStatus.NOT_ACCEPTABLE)
|
||||
val NOT_ACCEPTABLE
|
||||
get() = code(HttpStatus.NOT_ACCEPTABLE)
|
||||
|
||||
val PROXY_AUTHENTICATION_REQUIRED = code(HttpStatus.PROXY_AUTHENTICATION_REQUIRED)
|
||||
val PROXY_AUTHENTICATION_REQUIRED
|
||||
get() = code(HttpStatus.PROXY_AUTHENTICATION_REQUIRED)
|
||||
|
||||
val REQUEST_TIMEOUT = code(HttpStatus.REQUEST_TIMEOUT)
|
||||
val REQUEST_TIMEOUT
|
||||
get() = code(HttpStatus.REQUEST_TIMEOUT)
|
||||
|
||||
val CONFLICT = code(HttpStatus.CONFLICT)
|
||||
val CONFLICT
|
||||
get() = code(HttpStatus.CONFLICT)
|
||||
|
||||
val GONE = code(HttpStatus.GONE)
|
||||
val GONE
|
||||
get() = code(HttpStatus.GONE)
|
||||
|
||||
val LENGTH_REQUIRED = code(HttpStatus.LENGTH_REQUIRED)
|
||||
val LENGTH_REQUIRED
|
||||
get() = code(HttpStatus.LENGTH_REQUIRED)
|
||||
|
||||
val PRECONDITION_FAILED = code(HttpStatus.PRECONDITION_FAILED)
|
||||
val PRECONDITION_FAILED
|
||||
get() = code(HttpStatus.PRECONDITION_FAILED)
|
||||
|
||||
val PAYLOAD_TOO_LARGE = code(HttpStatus.PAYLOAD_TOO_LARGE)
|
||||
val PAYLOAD_TOO_LARGE
|
||||
get() = code(HttpStatus.PAYLOAD_TOO_LARGE)
|
||||
|
||||
val UNSUPPORTED_MEDIA_TYPE = code(HttpStatus.UNSUPPORTED_MEDIA_TYPE)
|
||||
val UNSUPPORTED_MEDIA_TYPE
|
||||
get() = code(HttpStatus.UNSUPPORTED_MEDIA_TYPE)
|
||||
|
||||
val REQUESTED_RANGE_NOT_SATISFIABLE = code(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE)
|
||||
val REQUESTED_RANGE_NOT_SATISFIABLE
|
||||
get() = code(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE)
|
||||
|
||||
val EXPECTATION_FAILED = code(HttpStatus.EXPECTATION_FAILED)
|
||||
val EXPECTATION_FAILED
|
||||
get() = code(HttpStatus.EXPECTATION_FAILED)
|
||||
|
||||
val I_AM_A_TEAPOT = code(HttpStatus.I_AM_A_TEAPOT)
|
||||
val I_AM_A_TEAPOT
|
||||
get() = code(HttpStatus.I_AM_A_TEAPOT)
|
||||
|
||||
val UNPROCESSABLE_ENTITY = code(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
val UNPROCESSABLE_ENTITY
|
||||
get() = code(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
|
||||
val LOCKED = code(HttpStatus.LOCKED)
|
||||
val LOCKED
|
||||
get() = code(HttpStatus.LOCKED)
|
||||
|
||||
val FAILED_DEPENDENCY = code(HttpStatus.FAILED_DEPENDENCY)
|
||||
val FAILED_DEPENDENCY
|
||||
get() = code(HttpStatus.FAILED_DEPENDENCY)
|
||||
|
||||
val UPGRADE_REQUIRED = code(HttpStatus.UPGRADE_REQUIRED)
|
||||
val UPGRADE_REQUIRED
|
||||
get() = code(HttpStatus.UPGRADE_REQUIRED)
|
||||
|
||||
val PRECONDITION_REQUIRED = code(HttpStatus.PRECONDITION_REQUIRED)
|
||||
val PRECONDITION_REQUIRED
|
||||
get() = code(HttpStatus.PRECONDITION_REQUIRED)
|
||||
|
||||
val TOO_MANY_REQUESTS = code(HttpStatus.TOO_MANY_REQUESTS)
|
||||
val TOO_MANY_REQUESTS
|
||||
get() = code(HttpStatus.TOO_MANY_REQUESTS)
|
||||
|
||||
val REQUEST_HEADER_FIELDS_TOO_LARGE = code(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE)
|
||||
val REQUEST_HEADER_FIELDS_TOO_LARGE
|
||||
get() = code(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE)
|
||||
|
||||
val UNAVAILABLE_FOR_LEGAL_REASONS = code(HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS)
|
||||
val UNAVAILABLE_FOR_LEGAL_REASONS
|
||||
get() = code(HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS)
|
||||
|
||||
val INTERNAL_SERVER_ERROR = code(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
val INTERNAL_SERVER_ERROR
|
||||
get() = code(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
|
||||
val NOT_IMPLEMENTED = code(HttpStatus.NOT_IMPLEMENTED)
|
||||
val NOT_IMPLEMENTED
|
||||
get() = code(HttpStatus.NOT_IMPLEMENTED)
|
||||
|
||||
val BAD_GATEWAY = code(HttpStatus.BAD_GATEWAY)
|
||||
val BAD_GATEWAY
|
||||
get() = code(HttpStatus.BAD_GATEWAY)
|
||||
|
||||
val SERVICE_UNAVAILABLE = code(HttpStatus.SERVICE_UNAVAILABLE)
|
||||
val SERVICE_UNAVAILABLE
|
||||
get() = code(HttpStatus.SERVICE_UNAVAILABLE)
|
||||
|
||||
val GATEWAY_TIMEOUT = code(HttpStatus.GATEWAY_TIMEOUT)
|
||||
val GATEWAY_TIMEOUT
|
||||
get() = code(HttpStatus.GATEWAY_TIMEOUT)
|
||||
|
||||
val HTTP_VERSION_NOT_SUPPORTED = code(HttpStatus.HTTP_VERSION_NOT_SUPPORTED)
|
||||
val HTTP_VERSION_NOT_SUPPORTED
|
||||
get() = code(HttpStatus.HTTP_VERSION_NOT_SUPPORTED)
|
||||
|
||||
val VARIANT_ALSO_NEGOTIATES = code(HttpStatus.VARIANT_ALSO_NEGOTIATES)
|
||||
val VARIANT_ALSO_NEGOTIATES
|
||||
get() = code(HttpStatus.VARIANT_ALSO_NEGOTIATES)
|
||||
|
||||
val INSUFFICIENT_STORAGE = code(HttpStatus.INSUFFICIENT_STORAGE)
|
||||
val INSUFFICIENT_STORAGE
|
||||
get() = code(HttpStatus.INSUFFICIENT_STORAGE)
|
||||
|
||||
val LOOP_DETECTED = code(HttpStatus.LOOP_DETECTED)
|
||||
val LOOP_DETECTED
|
||||
get() = code(HttpStatus.LOOP_DETECTED)
|
||||
|
||||
val BANDWIDTH_LIMIT_EXCEEDED = code(HttpStatus.BANDWIDTH_LIMIT_EXCEEDED)
|
||||
val BANDWIDTH_LIMIT_EXCEEDED
|
||||
get() = code(HttpStatus.BANDWIDTH_LIMIT_EXCEEDED)
|
||||
|
||||
val NOT_EXTENDED = code(HttpStatus.NOT_EXTENDED)
|
||||
val NOT_EXTENDED
|
||||
get() = code(HttpStatus.NOT_EXTENDED)
|
||||
|
||||
val NETWORK_AUTHENTICATION_REQUIRED = code(HttpStatus.NETWORK_AUTHENTICATION_REQUIRED)
|
||||
val NETWORK_AUTHENTICATION_REQUIRED
|
||||
get() = code(HttpStatus.NETWORK_AUTHENTICATION_REQUIRED)
|
||||
|
||||
/* REGEX */
|
||||
|
||||
val anyAlphaUnicode
|
||||
get() = delegate.anyAlphaUnicode()
|
||||
|
||||
val anyAlphaNumeric
|
||||
get() = delegate.anyAlphaNumeric()
|
||||
|
||||
val anyNumber
|
||||
get() = delegate.anyNumber()
|
||||
|
||||
val anyInteger
|
||||
get() = delegate.anyInteger()
|
||||
|
||||
val anyPositiveInt
|
||||
get() = delegate.anyPositiveInt()
|
||||
|
||||
val anyDouble
|
||||
get() = delegate.anyDouble()
|
||||
|
||||
val anyHex
|
||||
get() = delegate.anyHex()
|
||||
|
||||
val aBoolean
|
||||
get() = delegate.aBoolean()
|
||||
|
||||
val anyIpAddress
|
||||
get() = delegate.anyIpAddress()
|
||||
|
||||
val anyHostname
|
||||
get() = delegate.anyHostname()
|
||||
|
||||
val anyEmail
|
||||
get() = delegate.anyEmail()
|
||||
|
||||
val anyUrl
|
||||
get() = delegate.anyUrl()
|
||||
|
||||
val anyHttpsUrl
|
||||
get() = delegate.anyHttpsUrl()
|
||||
|
||||
val anyUuid
|
||||
get() = delegate.anyUuid()
|
||||
|
||||
val anyDate
|
||||
get() = delegate.anyDate()
|
||||
|
||||
val anyDateTime
|
||||
get() = delegate.anyDateTime()
|
||||
|
||||
val anyTime
|
||||
get() = delegate.anyTime()
|
||||
|
||||
val anyIso8601WithOffset
|
||||
get() = delegate.anyIso8601WithOffset()
|
||||
|
||||
val anyNonBlankString
|
||||
get() = delegate.anyNonBlankString()
|
||||
|
||||
val anyNonEmptyString
|
||||
get() = delegate.anyNonEmptyString()
|
||||
|
||||
/* HELPER FUNCTIONS */
|
||||
|
||||
@@ -191,87 +312,33 @@ class ResponseDsl : CommonDsl(), RegexCreatingProperty<ServerDslProperty> {
|
||||
|
||||
fun v(value: ClientDslProperty) = delegate.value(value)
|
||||
|
||||
fun `$`(value: ClientDslProperty) = delegate.value(value)
|
||||
|
||||
fun value(value: DslProperty<Any>) = delegate.value(value)
|
||||
|
||||
fun v(value: DslProperty<Any>) = delegate.value(value)
|
||||
|
||||
fun `$`(value: DslProperty<Any>) = delegate.value(value)
|
||||
|
||||
fun value(value: Pattern) = delegate.value(value)
|
||||
|
||||
fun v(value: Pattern) = delegate.value(value)
|
||||
|
||||
fun `$`(value: Pattern) = delegate.value(value)
|
||||
|
||||
fun value(value: RegexProperty) = delegate.value(value)
|
||||
|
||||
fun v(value: RegexProperty) = delegate.value(value)
|
||||
|
||||
fun `$`(value: RegexProperty) = delegate.value(value)
|
||||
|
||||
fun value(value: Any?) = delegate.value(value)
|
||||
|
||||
fun v(value: Any?) = delegate.value(value)
|
||||
|
||||
fun `$`(value: Any?) = delegate.value(value)
|
||||
|
||||
fun value(client: ClientDslProperty, server: ServerDslProperty) = delegate.value(client, server)
|
||||
|
||||
fun v(client: ClientDslProperty, server: ServerDslProperty) = delegate.value(client, server)
|
||||
|
||||
fun `$`(client: ClientDslProperty, server: ServerDslProperty) = delegate.value(client, server)
|
||||
|
||||
fun value(server: ServerDslProperty, client: ClientDslProperty) = delegate.value(client, server)
|
||||
|
||||
fun v(server: ServerDslProperty, client: ClientDslProperty) = delegate.value(client, server)
|
||||
|
||||
fun `$`(server: ServerDslProperty, client: ClientDslProperty) = delegate.value(client, server)
|
||||
|
||||
fun fromRequest() = FromRequestDsl()
|
||||
|
||||
override fun anyAlphaUnicode() = delegate.anyAlphaUnicode()
|
||||
|
||||
override fun anyAlphaNumeric() = delegate.anyAlphaNumeric()
|
||||
|
||||
override fun anyNumber() = delegate.anyNumber()
|
||||
|
||||
override fun anyInteger() = delegate.anyInteger()
|
||||
|
||||
override fun anyPositiveInt() = delegate.anyPositiveInt()
|
||||
|
||||
override fun anyDouble() = delegate.anyDouble()
|
||||
|
||||
override fun anyHex() = delegate.anyHex()
|
||||
|
||||
override fun aBoolean() = delegate.aBoolean()
|
||||
|
||||
override fun anyIpAddress() = delegate.anyIpAddress()
|
||||
|
||||
override fun anyHostname() = delegate.anyHostname()
|
||||
|
||||
override fun anyEmail() = delegate.anyEmail()
|
||||
|
||||
override fun anyUrl() = delegate.anyUrl()
|
||||
|
||||
override fun anyHttpsUrl() = delegate.anyHttpsUrl()
|
||||
|
||||
override fun anyUuid() = delegate.anyUuid()
|
||||
|
||||
override fun anyDate() = delegate.anyDate()
|
||||
|
||||
override fun anyDateTime() = delegate.anyDateTime()
|
||||
|
||||
override fun anyTime() = delegate.anyTime()
|
||||
|
||||
override fun anyIso8601WithOffset() = delegate.anyIso8601WithOffset()
|
||||
|
||||
override fun anyNonBlankString() = delegate.anyNonBlankString()
|
||||
|
||||
override fun anyNonEmptyString() = delegate.anyNonEmptyString()
|
||||
|
||||
override fun anyOf(vararg values: String?) = delegate.anyOf(*values)
|
||||
fun anyOf(vararg values: String?) = delegate.anyOf(*values)
|
||||
|
||||
internal fun get(): Response {
|
||||
val response = Response()
|
||||
|
||||
@@ -193,16 +193,16 @@ class ContractTests {
|
||||
val contract = contract {
|
||||
input {
|
||||
messageFrom("input")
|
||||
messageBody("foo" to anyNonBlankString())
|
||||
messageBody("foo" to anyNonBlankString)
|
||||
headers {
|
||||
header("foo", anyNumber())
|
||||
header("foo", anyNumber)
|
||||
}
|
||||
}
|
||||
outputMessage {
|
||||
sentTo("output")
|
||||
body("foo2" to anyNonEmptyString())
|
||||
body("foo2" to anyNonEmptyString)
|
||||
headers {
|
||||
header("foo2", anyIpAddress())
|
||||
header("foo2", anyIpAddress)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -512,7 +512,7 @@ then:
|
||||
url = url("/path")
|
||||
body = body("id" to mapOf("value" to "132"))
|
||||
bodyMatchers {
|
||||
jsonPath( "$.id.value", byRegex(anInteger()))
|
||||
jsonPath( "$.id.value", byRegex(anInteger))
|
||||
}
|
||||
}
|
||||
response {
|
||||
@@ -526,7 +526,7 @@ then:
|
||||
contentType = APPLICATION_JSON
|
||||
}
|
||||
bodyMatchers {
|
||||
jsonPath("$.id.value", byTimestamp())
|
||||
jsonPath("$.id.value", byTimestamp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,14 +24,14 @@ contract {
|
||||
url = url("/tests")
|
||||
multipart {
|
||||
field("file1", named(
|
||||
value(consumer(regex(nonEmpty())), producer("filename1")),
|
||||
value(consumer(regex(nonEmpty())), producer("content1"))))
|
||||
value(consumer(regex(nonEmpty)), producer("filename1")),
|
||||
value(consumer(regex(nonEmpty)), producer("content1"))))
|
||||
field("file2", named(
|
||||
value(consumer(regex(nonEmpty())), producer("filename2")),
|
||||
value(consumer(regex(nonEmpty())), producer("content2"))))
|
||||
value(consumer(regex(nonEmpty)), producer("filename2")),
|
||||
value(consumer(regex(nonEmpty)), producer("content2"))))
|
||||
field("test", named(
|
||||
value(consumer(regex(nonEmpty())), producer("filename3")),
|
||||
value(consumer(regex(nonEmpty())), producer(file("test.json"))),
|
||||
value(consumer(regex(nonEmpty)), producer("filename3")),
|
||||
value(consumer(regex(nonEmpty)), producer(file("test.json"))),
|
||||
value("application/json")))
|
||||
}
|
||||
headers {
|
||||
|
||||
Reference in New Issue
Block a user