mockito-kotlin icon indicating copy to clipboard operation
mockito-kotlin copied to clipboard

Using Mockito with Kotlin

Results 98 mockito-kotlin issues
Sort by recently updated
recently updated
newest added
trafficstars

Hi, I am working with Mockito and Kotlin, everything works well in AndroidTests, but when I use Mockito on tests, it shows me this message and I don't know how...

I'm trying to use argumentCaptor for inline function. Every time I run the test I'm getting **captor.capture() must not be null**. Any suggestion? ``` val captor = argumentCaptor Unit>() @Before...

Hi, I'm mocking spring repository with signature: ``` JpaRepository { S save(S entity); } ``` Here is my try: ``` val mockRepository = mock { on { save(any()) } doThrow...

I'm trying to mock a simple interface in my Kotlin project, but receiving the following error: ``` Mockito cannot mock this class: interface MyInterface. Mockito can only mock non-private &...

Not sure if you want to, but why not migrate to JUnit 5 I thought :)

Mocking below suspend function type ```kotlin someFunction: suspend () -> Boolean ``` throws `NullPointerException`. If I remove suspend keyword and use simple mocking like ```kotlin on { invoke() }.doReturn {...

Hi, my tests look like package com.example.wichtelquiz.framework import com.example.wichtelquiz.edm.Frage import com.nhaarman.mockitokotlin2.* import org.junit.After import org.junit.Assert.* import org.junit.Before import org.junit.Test import org.mockito.Mock import org.mockito.internal.invocation.MockitoMethod import org.mockito.internal.verification.Times class SpielerTest { lateinit var...

I just realized that I can't use `argumentCaptor`. I have to use the `nullableArgumentCaptor` for that. After looking into the implementation I really don't get why there is an explicite...

If you have a project using Kotlin 1.4.21 (and mockito-kotlin 2.2.0) and you turn on the new IR backend, the mocking behavior changes. Without IR, this mock seems to work...

[The "quirk" ](https://github.com/nhaarman/mockito-kotlin/blob/ec75b8aca66a872234aaec9a55ea34e62958c225/mockito-kotlin/src/main/kotlin/com/nhaarman/mockitokotlin2/internal/CreateInstance.kt#L40)that mockito-kotlin is relying on to create mock instances is [targeted to be fixed in the upcoming 1.3.20 release of kotlin](https://youtrack.jetbrains.com/issue/KT-8135). What to do after that? ----- Edit...

on-hold
critical