Replies: 5 comments 2 replies
-
I like them, thanks for the idea! I just have a change I'd make: I don't think they would need parameters for atLeast and atMost if these are meant to verify that the inner block is being executed exactly once or exactly zero times. The API I would implement, then, is like this:
In fact, MockK already ignores What do you think? |
Beta Was this translation helpful? Give feedback.
-
I think it is better like this:
And maybe useful another little verify helpers:
|
Beta Was this translation helpful? Give feedback.
-
Yep your suggestion about the Not entirely sure about the Plus, I'm a bit worried about the idea of providing two different but still pretty similar ways to do the same thing, I'm wondering if it could be confusing for users. The second one makes more sense to me :) |
Beta Was this translation helpful? Give feedback.
-
(Also, thanks a lot for taking the time to think about this!) |
Beta Was this translation helpful? Give feedback.
-
I came here to suggest Also, although beyond the scope of /**
* relaxUnitFun = true
*/
inline fun <reified T : Any> mockkR(
name: String? = null,
vararg moreInterfaces: KClass<*>,
block: T.() -> Unit = {}
) = mockk(
name = name,
relaxed = false,
moreInterfaces = moreInterfaces,
relaxUnitFun = true,
block = block
) |
Beta Was this translation helpful? Give feedback.
-
Hi! How about adding such extensions? I think code would be cleaner with such extensions. I'm already using them in my own projects.
Maybe i could make a pull request with such extensions if needed.
Beta Was this translation helpful? Give feedback.
All reactions