title: Verify method called in unit testing using coroutine with delay
body: <p>I've been reading <a href="https://craigrussell.io/2019/11/unit-testing-coroutine-suspend-functions-using-testcoroutinedispatcher/" rel="nofollow noreferrer">this article</a> to understand how to unit test a coroutine that contains a delay and applied it, but I still don't understand why <code>verify</code> is being called before having called myDelayedMethod() in the coroutine and therefore the verification fails. Isn't there a way to execute the code synchronously in the test?</p>
  <p>Pseudocode:</p>
  <pre><code>class ClasUnderTest{
  
    fun method1(){
        GlobalScope.launch {
        myDelayedMethod()
      }
    }
  
    suspend fun myDelayedMethod(): String{
      withContext(dispatchers.default()){
        delay(X)
        ...
        someClass.someMethod()
     }
    }
  }
  
  @Test
  fun myTest()= coroutinesTestRule.testDispatcher.runBlockingTest {
    val someClassMock = mock(SomeClass::class.java)
    val myObject = ClasUnderTest(someClassMock) 
    method1()
    verify(someClassMock).someMethod()
  }
  </code></pre>