You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After a version update, I saw lot of test started to fail,
I've tracked down the issue to a compatibility issue between awaitility and kluent,
in awaitility ( maybe also in other libraries.. I don't know ) await untilAsserted { X shouldBeEqualTo Y }
the untilAsserted function expect the lambda assertion to return a AssertionError error , it seemed to be the case in the past ( with shouldBe , now deprecated in favor of shouldBeEqualTo ) but now it's changed and those assertion are just exceptions in kluent ,
a ugly workaround for me was overriding all those operators and wrap the exception in AssertionError
ie :
infix fun <I : Iterable<*>> I.assertShouldHaveSize(expectedSize: Int): I {
return apply { try {
this shouldHaveSize expectedSize
}catch (cfe : ComparisonFailedException){
throw AssertionError(cfe)
}
}
}
The text was updated successfully, but these errors were encountered:
fvigotti
changed the title
changed inheritance from AssertionError caused incompatibility with awaitility
changed inheritance from AssertionError caused assertion not working with awaitility
Sep 7, 2022
I'm afraid, there's no clean way to achieve that, as awaitility catches only AssertionError to handle untilAsserted.
Kluent uses ComparisonFailedException in order to help IntelliJ/AS to show the comparison window. From other side (BTW, why did you decide that shouldBe is deprecated in flavor of shouldBeEqualTo? They are slightly different assertions), you can either use shouldBe (if it suites your needs) or wrap your lambda into assertSoftly (based on KotlinTest.kt):
After a version update, I saw lot of test started to fail,
I've tracked down the issue to a compatibility issue between awaitility and kluent,
in awaitility ( maybe also in other libraries.. I don't know )
await untilAsserted { X shouldBeEqualTo Y }
the
untilAsserted
function expect the lambda assertion to return a AssertionError error , it seemed to be the case in the past ( with shouldBe , now deprecated in favor of shouldBeEqualTo ) but now it's changed and those assertion are just exceptions in kluent ,a ugly workaround for me was overriding all those operators and wrap the exception in AssertionError
ie :
The text was updated successfully, but these errors were encountered: