willowtreeapps / assertk

assertions for kotlin inspired by assertj
MIT License
760 stars 85 forks source link

Do not allow null-based assertions on non-null types #478

Closed JakeWharton closed 1 year ago

JakeWharton commented 1 year ago

Before: Screen Shot 2023-06-26 at 10 23 12 AM

After: Screen Shot 2023-06-26 at 10 23 23 AM

evant commented 1 year ago

Clever! This doesn't break assertions on platform types right? I don't think it would?

JakeWharton commented 1 year ago

I will check tonight

JakeWharton commented 1 year ago

Sadly it selects the non-null variant :(

JakeWharton commented 1 year ago

I'm assuming that is a deal-breaker. I can't see a path forward. It's weird that it selects the non-null variant. I spent a little time trying to investigate ways to trick it and couldn't come up with anything.

evant commented 1 year ago

Yeah you'd need to assert both on a platform type. Could do something weird like only added them to the native variant? Not sure it's worth though.