Skip to content

Instantly share code, notes, and snippets.

@dstarcev
Created October 29, 2016 20:27
Show Gist options
  • Save dstarcev/6046c5c54b3e502123b6898955b87115 to your computer and use it in GitHub Desktop.
Save dstarcev/6046c5c54b3e502123b6898955b87115 to your computer and use it in GitHub Desktop.
import be.vergauwen.simon.mockito1_kotlin.any
import be.vergauwen.simon.mockito1_kotlin.doNothing
import be.vergauwen.simon.mockito1_kotlin.spy
import be.vergauwen.simon.mockito1_kotlin.whenever
import org.junit.Test
class KotlinMockitoTest {
@Test
fun test() {
val spy = spy<TestInterface>(TestClass())
doNothing()
.whenever(spy).call(any())
spy.call(TestClass())
}
interface TestInterface {
fun call(obj: TestInterface)
}
open class TestClass : TestInterface {
override fun call(obj: TestInterface) {
TODO()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment