Michael Vandendriessche
02/24/2022, 2:48 PMClassWithManyStaticMethods.getSomething().method(lateInitialisedField)
I finally figured out how to mock the static class but stumble upon following error
lateinit property lateInitialisedField has not been initialized
.
So the lateInitialisedField
is a lateinit in the class I want to test. When I call the function I want to test, the lateInitialisedField
is not initialised.
How do I initialise it in the test or prevent the error? The value does not matter for my test, I just want to verify if method
has been called.
I tried using @InjectMocks
when I create the class under test and created a mockk lateInitialisedField
in my test but either I'm doing something wrong or this is not the solution.
If anyone could point me in the right direction that would be greatly appreciated!Mattia Tommasone
02/24/2022, 2:55 PMlateInitializedField
being initialized? is it publicly accessible, i.e. can you initialize it in your test?Michael Vandendriessche
02/24/2022, 4:16 PMonCreateView
. Initialised with a property on the same class as above ClassWithManyStaticMethods.getSomething().someProperty
Michael Vandendriessche
02/24/2022, 4:17 PM