All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lucasls.kotlinx.wiremock.VerificationDSL.kt Maven / Gradle / Ivy

There is a newer version: 0.1.2
Show newest version
@file:Suppress("unused")
package com.lucasls.kotlinx.wiremock

import com.github.tomakehurst.wiremock.client.CountMatchingStrategy
import com.github.tomakehurst.wiremock.junit.Stubbing
import com.github.tomakehurst.wiremock.matching.RequestPatternBuilder

object GlobalVerificationScope {
    operator fun Int.times(requestPatternBuilder: RequestPatternBuilder) {
        verify(this, requestPatternBuilder)
    }

    operator fun CountMatchingStrategy.times(requestPatternBuilder: RequestPatternBuilder) {
        verify(this, requestPatternBuilder)
    }
}

class StubbingVerificationScope(private val stubbing: Stubbing) {
    operator fun Int.times(requestPatternBuilder: RequestPatternBuilder) {
        stubbing.verify(this, requestPatternBuilder)
    }

}

fun verify(block: GlobalVerificationScope.() -> Unit) {
    GlobalVerificationScope.block()
}

fun Stubbing.verify(block: StubbingVerificationScope.() -> Unit) {
    StubbingVerificationScope(this).block()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy