I think the best thing would be `infix fun <T :...
# kotlintest
d
I think the best thing would be
infix fun <T : Any?> T.shouldNotBeNull(assertionBlock: (T.() -> Unit)? = null)
, which is consistent and explicit, also the tests would continue on the properties, not the object itself (at worst there's always
this
)... Also the
shouldBeInstance<Foo> { }
could similarly cast a more general object to Foo for further assertions, but then would it be on
Any?
too? So maybe there could be
infix fun <T : Any?> T.shouldNotBeNullAnd(assertionBlock: ((T) -> Unit)? = null)
for assertions on the object itself, and then use smart casting and contracts when they're out inside the block... same question as before, but I think the name and style is more appropriate...