Cannot mock final Kotlin class using Mockito 2 : <p>I am unable to mock a Kotlin final class using Mockito 2. I am using Robolectric in addition.</p>

<p>This is my test code:</p>

<pre><code>@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
public class Test {

    // more mocks

    @Mock
    MyKotlinLoader kotlinLoader;

    @Before
    public void setUp() {
        MockitoAnnotations.initMocks(this);
    }
}
</code></pre>

<p>The test fails when we try to initialise the mocks in the <code>setUp()</code> method.</p>

<p>In addition, I am using the following gradle dependencies in my code:</p>

<pre><code>testCompile 'org.robolectric:robolectric:3.3.2'
testCompile 'org.robolectric:shadows-multidex:3.3.2'
testCompile 'org.robolectric:shadows-support-v4:3.3.2'
testCompile("org.powermock:powermock-api-mockito2:1.7.0") {
    exclude module: 'hamcrest-core'
    exclude module: 'objenesis'
}
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-inline:2.8.9'
</code></pre>

<p>All other unit tests pass using this configuration but as soon as I try to mock the Kotlin class it throws the following error:</p>

<p><code>Mockito cannot mock/spy because :
 - final class</code></p>

<p>Please note I am using Mockito version 2 and I am using the <code>inline</code> dependency which automatically enables the ability to mock final classes.</p>
