Pablo
10/01/2020, 7:26 AMgildor
10/01/2020, 7:31 AMPablo
10/01/2020, 7:33 AMgildor
10/01/2020, 7:35 AMgildor
10/01/2020, 7:36 AMgildor
10/01/2020, 7:36 AMgildor
10/01/2020, 7:37 AMgildor
10/01/2020, 7:37 AMPablo
10/01/2020, 8:11 AMTestCoroutineScope and the TestcoroutineDispatcher i don't need to use the Dispatchers.setMain(TestCoroutineDispatcher()) and Dispatchers.resetMain() right? Because I'm setting it on my constructorgildor
10/01/2020, 8:23 AMgildor
10/01/2020, 8:24 AMPablo
10/01/2020, 8:31 AMTestCoroutineScope and TestCoroutineDispatcher via constructor on my rule I don't need this
@Beforeall
fun setUp(){
Dispatchers.setMain(TestCoroutineDispatcher())
}
@afterEach
fun afterEach(){
testScope.cleanUpTestCoroutines()
}
@AfterAll
fun tearDown(){
Dispatchers.resetMain()
}Pablo
10/01/2020, 8:54 AMgildor
10/01/2020, 9:17 AMgildor
10/01/2020, 9:17 AMgildor
10/01/2020, 9:18 AMPablo
10/01/2020, 3:21 PMCoroutineScope and the CoroutineDispatcher does it helps? No, right?
I mean, if I do inject, and in the test create the TestCoroutineScope and the TestCoroutineDispatcher and create the presenter on this case passing that as a parameter, I don't need anything else, right?
Or do I have to cleanUpTestCoroutines() in the tearDown ? What I mean is, I created the Rule but now that you've explained to me that Dispatchers.setMain(..) and Dispatchers.resetMain() doesn't change the IO it's not necessary to do it anymore, even if I'm creating the TestCoroutineDispatcher right?
So when creating the test I just need, create these TestCoroutineX and that's it?gildor
10/01/2020, 3:28 PMPablo
10/01/2020, 3:31 PMcleanupTestCoroutines() ?gildor
10/01/2020, 3:36 PMPablo
10/01/2020, 3:37 PMPablo
10/01/2020, 3:37 PMgildor
10/01/2020, 3:37 PM