ilya.gorbunov
11/24/2016, 10:56 PMfailingCast method, compiler doesn't know whether you invoke that lambda or not inside test method. So it cannot count on that the variable is initialized inside the lambda, because that block is not guaranteed to be called.