title: How mock Kotlin extension function in interface?
body: <p>I have an extension function for interface like the following:</p>
  
  <pre><code>import javax.jms.ConnectionFactory
  
  fun ConnectionFactory.foo() {
      println("do some stuff")
  }
  </code></pre>
  
  <p><p>How can I mock the function foo?<p>
  Please note, I have seen approaches for classes and objects in <a href="http://mockk.io/#extension-functions" rel="nofollow noreferrer">http://mockk.io/#extension-functions</a>, but it does not work. I have tried this one:</p>
  
  <pre><code>import io.mockk.classMockk
  import io.mockk.every
  import org.junit.Test
  import javax.jms.ConnectionFactory
  
  class ExtensionFunctionTest {
  @Test
  fun mockExtensionFunction() {
      val connectionFactory = classMockk(ConnectionFactory::class)
      every { connectionFactory.foo() } returns println("do other stuff")
      connectionFactory.foo()
  }
  }
  </code></pre>
  
  <p>It throws exception:</p>
  
  <pre><code>io.mockk.MockKException: Missing calls inside every { ... } block.
  </code></pre>