I want to mock instance of javax.mail.Message, but unable to. Getting java.lang.VerifyError with no message.
Running:
- Kotlin - 1.3.10
- Mockk - 1.9
Simple code:
import io.mockk.every
import io.mockk.mockk
import org.junit.Test
import javax.mail.Message
class MessageTest {
private val message = mockk<Message>()
@Test
fun testMockMessage() {
}
}
Exception:
java.lang.VerifyError
at sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
at sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:144)
at io.mockk.proxy.jvm.transformation.InlineInstrumentation.execute(InlineInstrumentation.kt:39)
at io.mockk.proxy.jvm.ProxyMaker.inline(ProxyMaker.kt:88)
at io.mockk.proxy.jvm.ProxyMaker.proxy(ProxyMaker.kt:30)
at io.mockk.impl.instantiation.JvmMockFactory.newProxy(JvmMockFactory.kt:34)
at io.mockk.impl.instantiation.AbstractMockFactory.newProxy$default(AbstractMockFactory.kt:29)
at io.mockk.impl.instantiation.AbstractMockFactory.mockk(AbstractMockFactory.kt:58)
at service.mailer.MailerTest.<init>(MailerTest.kt:32)
Tried to mock the same thing in Java tests with org.easymock.Mock and had no problem there. Any ideas?