Why IDEA is loading jmockit when I run testNG?

Hi all
Sorry for many questions related to mocking and testng env.
I am having this issue for 3-4 days.
Here is my code:

import org.testng.Assert;
import org.testng.annotations.Test;

public class TestNGDemo {
    @Test
    public void sum() {
        Assert.assertEquals(7, 4 + 4);
    }

    @Test
    public void sub() {
        Assert.assertEquals(0, 4 - 4);
    }

    /*
    * I am not a test.
    */
    public void sumNotTest() {
        Assert.assertEquals(7, 4 + 4);
    }

    /*
    * I am not a test.
    */
    public void subNotTest() {
        Assert.assertEquals(0, 4 - 4);
    }
}



I have one project which contains 5 modules, test is loced in one module. From run configuration page, USe classpath of module I showed the module that contains test case, But when I run it I am getting:

WARNING: JMockit was initialized on demand, which may cause certain tests to fail;
please check the documentation for better ways to get it initialized.
WARNING: JMockit was initialized on demand, which may cause certain tests to fail;
please check the documentation for better ways to get it initialized.
java.util.ServiceConfigurationError: org.testng.ITestNGListener: Provider mockit.integration.testng.Initializer could not be instantiated: java.lang.NullPointerException
 at java.util.ServiceLoader.fail(ServiceLoader.java:207)
 at java.util.ServiceLoader.access$100(ServiceLoader.java:164)
 at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:353)
 at java.util.ServiceLoader$1.next(ServiceLoader.java:421)
 at org.testng.TestNG.addServiceLoaderListeners(TestNG.java:899)
 at org.testng.TestNG.initializeConfiguration(TestNG.java:834)
 at org.testng.TestNG.run(TestNG.java:948)
 at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:109)
 at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
 at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
 at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:111)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:108)
Caused by: java.lang.NullPointerException
 at mockit.internal.startup.Startup.redefineMethods(Startup.java:184)
 at mockit.internal.startup.Startup.redefineMethods(Startup.java:176)
 at mockit.internal.annotations.MockClassSetup.applyClassModifications(MockClassSetup.java:190)
 at mockit.internal.annotations.MockClassSetup.redefineMethodsInClassHierarchy(MockClassSetup.java:151)
 at mockit.internal.annotations.MockClassSetup.redefineMethods(MockClassSetup.java:140)
 at mockit.Mockit.setUpMocks(Mockit.java:249)
 at mockit.integration.testng.internal.TestNGRunnerDecorator.<init>(TestNGRunnerDecorator.java:67)
 at mockit.integration.testng.internal.TestNGRunnerDecorator.registerWithTestNG(TestNGRunnerDecorator.java:60)
 at mockit.integration.testng.Initializer.<init>(Initializer.java:29)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at java.lang.Class.newInstance0(Class.java:355)
 at java.lang.Class.newInstance(Class.java:308)
 at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:345)
 ... 13 more
Disconnected from the target VM, address: '127.0.0.1:51006', transport: 'socket'

Process finished with exit code 0


famoues stack trace.

I created simple project and I run the code in that project and it is working.

My questions are:
Why idea is loading jmockit when i run testng?
if have multiple modules how can I run test case?

thanks in advance

Please sign in to leave a comment.