试图用 mockk 模拟 OffsetDateTime.now(),但它抛出
Missing calls inside every { ... } block
我试过了:
staticMockk<OffsetDateTime>().mock().run {
val mockTime = OffsetDateTime.now()
every { OffsetDateTime.now() } returns mockTime
// test
}
也试过:
mockkStatic(OffsetDateTime::class)
val mockTime = OffsetDateTime.now()
every { OffsetDateTime.now() } returns mockTime