willowtreeapps / assertk

assertions for kotlin inspired by assertj

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing representation

SerVB opened this issue · comments

Hi! I'm comparing assertk to assertj and bumped into innability to find a way to change representations in the assertions message (Assertions.useRepresentation).

Does it exist or is it not yet implemented?

IMO that is quite useful, and should be provided ootb.

You can pass a custom display function when calling assertThat
ex:

assertThat(foo, displayActual = { myCustomRepresentation(it) })

this could probably be better documented.

Does this cover the use-cases you are envisioning?

Thanks for the answer. This looks not so convenient, though, to always pass the display function. It's better to just somehow specify globally.

Oh you mean specifically a global setting then? Extending how show() works is something I've considered, but doing that in a way that's ergonomic and easy to understand is tricky.