I’m running in a weird error while testing android...
# test
j
I’m running in a weird error while testing android view models from junit tests. If I manually set
Dispatchers.setMain(UnconfinedTestDispatcher(testScheduler))
in my test function, it works. But if I use a Rule instead to do it, it fails. I do create the viewmodel from withing the test function and I do have the
@get:Rule
as the first thing in the test class. I really don’t understand what I’m doing wrong here. Any idea on what I am missing?
I think the issue comes from the
@kotlin.test.Test
annotation I’m using. If I replace it with the one from junit4, it works fine. I’m not sure if it’s a bug or an intended behaviour 🤷🏻