Reputation: 41
I have setup my spring boot project with jmockit 1.43
and spring boot 2.0.1
in InteliJIdea. I have written some test cases using jmockit expectations. I was able to run the test case from the command line but not from the intelij idea. Idea prints following error in the console.
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) Caused by: java.lang.IllegalStateException: JMockit didn't get initialized; please check the -javaagent JVM initialization parameter was used at mockit.internal.startup.Startup.verifyInitialization(Startup.java:91) at mockit.Invocations.(Invocations.java:25) ... 32 more
Upvotes: 4
Views: 5648
Reputation: 350
Guess you need to set the "-javaagent
" flag to your configuration...
See: http://jmockit.github.io/tutorial/Introduction.html#runningTests
Run Config in IntelliJ:
Upvotes: 7