Debugger will not work with JMockit

Hope this will be a simple question ...

I am using RAD 7.5.2 and I am writing Junit tests. I wrote them very well with JUnit 3, and then I wanted to come up with some function calls. So I downloaded jmockit 0.9.7 and Junit 4.6. I also include -javaagent: jmockit.jar as a VM argument.

When I run Run As Junit Test, it has no problems at all (at least not one that I can see on the output). Junit's output is good, and no errors are flushed to the console.

When I "Debug Like a Junit Test", it will not work. He throws me away:

InstrumentationImpl.class → Source not found

... and when I click continue ...

NativeMethodAccessorImpl.class → Source not found

... and when I click continue ...

After that, JUnit ends. It resets the following to the console:


Exception in the "main" thread java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0 (native method) at sun.reflect.NativeMethodAccessorImpl.inavaque (NativeMethodAccessorImpl.odflectodleplpllepleplleplepllectleccesspllepleplplelegplepllepleplplelegplepllepleplplelegplepllepleplplelegplepllepleplplelegplepllepleplopleplplléloplefplodlegplpllepleploplelectpllepleplpleplepllepleploplelectpllelegplpllople .java: 43) in java.lang.reflect.Method.invoke (Method.java:618) at sun.instrument.InstrumentationImpl.loadClassAndCallPremain (InstrumentationImpl.java:160) Reason: java.lang.UnsatisfiedLinkError: sun / instrument / InstrumentationImpl .redefineClasses0 ([Ljava / lang / instrument / ClassDefinition;) V at sun.instrument.InstrumentationImpl.redefineClasses (InstrumentationImpl.java:98) in mockit.internal.RedefinitionEngine.redefineMethods (RedefinitionEngine.java:197ng) m m .redefineMethods (RedefinitionEngine.java:184) in mockit.internal.RedefinitionEngine.redefineMethods (RedefinitionEngine.java:116) in mockit.internal .RedefinitionEngine.setUpInternalStartupMock (RedefinitionEngine.java:53) at mockit.internal.Startup.loadInternalStartupMocks (Startup.java:123) at mockit.internal.Startup.initialize (Startup.java:110) on mockit.internal Startup.java:97) ... 5 more

Fatal error: -javaagent processing failed


I can run both JUnit 3 and JUnit 4 in my tests without problems, when I use -javaagent: jmockit.jar (with the debugger, they themselves are okay), that everything becomes ugly, and I have to use for this jmockit.

Thoughts?

+6
debugging junit4 jmockit javaagents
source share
1 answer

I regularly run JUnit tests that use JMockit (with and without the JVM argument "-javaagent" JVM) in debug mode and never had any problems.

Are you sure that the class path for the Debug as Junit Test configuration is identical to the configuration for Run As Junit Test? Since you have an UnsatisfiedLinkError, it is possible that the jar file is missing.

If this is not the cause of the error, perhaps it is something specific to RAD 7.5.2 ...

+1
source share

All Articles