01/21/2019, 7:41 AM
The idea is do have a type of assertion composition, since as something not null, I need to assert more to assure that the result is as expected. Whereas
is not an assertion, and is the same as
result?.let  { }
and this will not lead to any runtime failure (nor is it really asserting anything, if null, which I feel is not such good testing practice... but that's my opinion). As mentioned before,
result!! should { }
is not an assertion, and will lead to a runtime failure. So
shouldNotBeNull { }
really makes the assertion, and allows to continue asserting on a non-null value. I admit that if contracts would be an option, there would likely not be a need for the lambda though... Also
might also have further asssertions on the smart casted type... @sam