initialize jmockit without -javaagent

隐身守侯 提交于 2021-01-28 05:05:06

问题


I use jmockit and junit to write unit test for a module and run it in a STB. I use jmockit-1.7 because the STB only have java 5.

I got this error when run unit test: java.lang.IllegalStateException: Jmockit has not been initialized. Check that your Java 5 VM has been started with -javaagent:jmockit.jar command line option

but my STB use siege java VM, so it doesn't have -javaagent command line option

I have google, and found a solution from Running tests with JMockit

@BeforeClass
public static void Initialize()
{
Mockit.setUpMocks();
}

But it's not work. And i have to uses jmockit-0.999.19 to have Mockit.setUpMocks();

Could any one help me initialize jmockit without -javaagent and run in java 1.5?


回答1:


3 years ago... Update: In the latest version JMockit v1.40 support for JDK6 will be dropped... so use JDK7+ ;-)



来源:https://stackoverflow.com/questions/29114036/initialize-jmockit-without-javaagent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!