Using Mockito doAnswer in Kotlin
doAnswer {
val design = Design()
val callback = it.arguments[0] as GetDesign.Listener
callback.onSuccess(design)
null // or you can type return@doAnswer null
}.`when`(someRepository).getDesign(any(GetDesign.Listener::class.java))