I am using MockK
for Unit-Tests and want to verify
if some function was called with current time(milliseconds) parameter.
In main app the function call:
functionName(System.currentTimeMillis())
But in test:
verify(exactly = 1) {
functionName(System.currentTimeMillis()) }
doesn't work, because milliseconds will be always different
your could use any() instead. which just verifies if function was called with any parameter of the argument type (in this case Long)
verify(exactly = 1) {
functionName(any())
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.