peekandpoke
11/02/2020, 1:55 PMassertSoftly
with shouldNotBe
?
I just upgraded from the old kotlintest to kotest:4.3.1 and now some of my tests fail.
When I remove the surrounding assertSoftly
block then everythings is fine again. The assertions stay the same but do no longer fail!
It also seems to only happen when I use shouldNotBe
Any idea? Thanks!LeoColman
11/02/2020, 7:20 PMpeekandpoke
11/02/2020, 9:38 PMenum class SimpleEnum {
First,
Second
}
data class WithSimpleEnum(val enumValue: SimpleEnum = SimpleEnum.First)
class AssertSoftlySpec : StringSpec({
"asserting me softly" {
val source = WithSimpleEnum(enumValue = SimpleEnum.First)
val result = WithSimpleEnum(enumValue = SimpleEnum.Second)
assertSoftly {
withClue("simple strings") {
"a" shouldBe "b"
"a" shouldNotBe "b"
}
withClue("more complex with data class and enums") {
source shouldBe result
source shouldNotBe result
}
}
}
})
The will output:
The following 4 assertions failed:
1) simple strings
expected:<"b"> but was:<"a">
at de.peekandpoke.ultra.AssertSoftlySpec$1$1.invokeSuspend(AssertMeSoftlySpec.kt:26)
2) more complex with data class and enums
expected:<Second> but was:<First>
at de.peekandpoke.ultra.AssertSoftlySpec$1$1.invokeSuspend(AssertMeSoftlySpec.kt:31)
3) more complex with data class and enums
expected:<WithSimpleEnum(enumValue=Second)> but was:<WithSimpleEnum(enumValue=First)>
at de.peekandpoke.ultra.AssertSoftlySpec$1$1.invokeSuspend(AssertMeSoftlySpec.kt:31)
4) more complex with data class and enums
expected:<Second> but was:<First>
at de.peekandpoke.ultra.AssertSoftlySpec$1$1.invokeSuspend(AssertMeSoftlySpec.kt:32)
withClue("more complex with data class and enums") {
source shouldBe result
source shouldNotBe result
}
What do you think is going on here?