问题描述
我使用jmockit和junit编写模块的单元测试,并在STB中运行它.我使用jmockit-1.7,因为机顶盒只有Java 5.
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.
运行单元测试时出现此错误: java.lang.IllegalStateException:Jmockit尚未初始化.使用-javaagent:jmockit.jar命令行选项检查您的Java 5 VM是否已启动
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
但是我的机顶盒使用攻城Java VM,因此它没有-javaagent命令行选项
but my STB use siege java VM, so it doesn't have -javaagent command line option
我有google,并从使用JMockit运行测试
I have google, and found a solution from Running tests with JMockit
@BeforeClass
public static void Initialize()
{
Mockit.setUpMocks();
}
但这是行不通的.而且我必须使用jmockit-0.999.19来具有 Mockit.setUpMocks();
But it's not work. And i have to uses jmockit-0.999.19 to have Mockit.setUpMocks();
有没有人可以帮助我在没有-javaagent的情况下初始化jmockit并在Java 1.5中运行?
Could any one help me initialize jmockit without -javaagent and run in java 1.5?
推荐答案
3年前...更新:在最新版本中,对JDK6的JMockit v1.40支持将被删除...因此,请使用JDK7 +;-)
3 years ago...Update: In the latest version JMockit v1.40 support for JDK6 will be dropped... so use JDK7+ ;-)
这篇关于不使用-javaagent初始化jmockit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!