我想模拟一个字符串扩展。
我已经阅读了如何使用的说明
mockStatic("kotlin.String")
或者
mockkStatic("kotlin.kotlin_builtins")
但它一直在说
Caused by: io.mockk.MockKException: Can't instantiate proxy for class kotlin.String
at io.mockk.impl.instantiation.JvmMockFactory.newProxy(JvmMockFactory.kt:64)
at io.mockk.impl.instantiation.AbstractMockFactory.newProxy$default(AbstractMockFactory.kt:29)
at io.mockk.impl.instantiation.AbstractMockFactory.spyk(AbstractMockFactory.kt:92)
at io.floriday.pdfgeneratorapi.integration.TradeItemListenerTest.<init>(TradeItemListenerTest.kt:131)
... 18 more
Caused by: io.mockk.proxy.MockKAgentException: Failed to create proxy for class java.lang.String.
class java.lang.String is one of excluded classes
at io.mockk.proxy.jvm.ProxyMaker.throwIfNotPossibleToProxy(ProxyMaker.kt:128)
at io.mockk.proxy.jvm.ProxyMaker.proxy(ProxyMaker.kt:28)
at io.mockk.impl.instantiation.JvmMockFactory.newProxy(JvmMockFactory.kt:34)
... 21 more
可能我在模拟错误的文件,但我似乎无法正确模拟文件名。任何帮助表示赞赏:-D