Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertDoesNotThrow
import org.junit.jupiter.api.assertThrows
import org.junit.jupiter.api.condition.DisabledIf

import org.springframework.cloud.contract.spec.ContractDsl.Companion.contract
import org.springframework.cloud.contract.spec.internal.Cookie
Expand All @@ -39,6 +40,11 @@ import org.springframework.cloud.contract.spec.internal.RegexProperty
*/
class ContractTests {

companion object {
@JvmStatic
fun isKotlin23OrGreater() = KotlinVersion.CURRENT.isAtLeast(2, 3)
}

@Test
fun `should work for http`() {
val contract = contract {
Expand Down Expand Up @@ -697,6 +703,7 @@ then:

@Test
@Suppress("UNCHECKED_CAST")
@DisabledIf(value = "org.springframework.cloud.contract.spec.ContractTests#isKotlin23OrGreater")
fun `should support multipart`() {
val contract = KotlinContractConverter()
.convertFrom(File(javaClass.classLoader.getResource("contracts/multipart.kts")!!.toURI()))
Expand Down Expand Up @@ -742,6 +749,7 @@ then:
}

@Test
@DisabledIf(value = "org.springframework.cloud.contract.spec.ContractTests#isKotlin23OrGreater")
fun `should use filename as fallback for single unnamed contract`() {
val contract = KotlinContractConverter()
.convertFrom(File(javaClass.classLoader.getResource("contracts/unnamed_single.kts")!!.toURI()))
Expand All @@ -754,6 +762,7 @@ then:
}

@Test
@DisabledIf(value = "org.springframework.cloud.contract.spec.ContractTests#isKotlin23OrGreater")
fun `should use filename with index as fallback for multiple unnamed contracts`() {
val contracts = KotlinContractConverter()
.convertFrom(File(javaClass.classLoader.getResource("contracts/unnamed_multiple.kts")!!.toURI()))
Expand Down