The Attach API simply doesn't work in the IBM JDK 6.0, at least on Windows. Therefore, it's necessary to use the -javaagent:jmockit.jar
parameter.
The NullPointerException
that occurs at MockClassSetup.java:59
, when using -javaagent
, is caused by a bug in the IBM JDK. When a type referenced in an annotation attribute (@MockClass
, in this case) is not present in the classpath, the JDK should throw a TypeNotPresentException
. The Oracle JDKs do so as expected, but the IBM JDK returns null
instead for the attribute value.
I just implemented a workaround for this in class MockClassSetup
, which will be available in the next JMockit release, by the end of september. For now, you can avoid the problem by adding TestNG to the classpath (since the "type not found" is the org.testng.TestNG
class).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…