Is there some good practice to test `ViewModel.onC...
# android
l
Is there some good practice to test
ViewModel.onCleared()
? It is protected, so cannot be called from tests... I cancel some coroutines jobs there and have to call it at the end of my test. I'm thinking about adding a separate method just for tests which calls
onCleared()
internally, but it seems quite ugly.
l
Oh yes, overriding it with public visibility would probably be the best option! Thank you! 🙏
816 Views