Skip to content
This repository was archived by the owner on Jan 3, 2025. It is now read-only.
This repository was archived by the owner on Jan 3, 2025. It is now read-only.

changed inheritance from AssertionError caused assertion not working with awaitility #213

@fvigotti

Description

@fvigotti

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)
    }
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions