title: How to stub this method with mockito
body: <p>I am using Mockito on kotlin class</p>
  
  <pre><code>androidTestImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
  </code></pre>
  
  <p>The method looks like this:</p>
  
  <pre><code>open class A {
    open fun doSomething(text: String, text1: String, callback:(Boolean)-&gt; Unit) {
      ...
    }
  
  }
  </code></pre>
  
  <p>I tried stubbing it the following way:</p>
  
  <pre><code> mock&lt;A&gt;() {
     on { doSomething(any(),any(), any())}.then {
           it.arguemnts.last().invoke(true)
      }
   }
  </code></pre>
  
  <p>But it fails on NPE:</p>
  
  <pre><code>Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Boolean.booleanValue()' on a null object reference
  </code></pre>
  
  <p>How to fix it?</p>