Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Jmockit 1.49 and IntelliJ 2021.1.1 #711

Open
modiboa opened this issue May 4, 2021 · 4 comments
Open

Issue with Jmockit 1.49 and IntelliJ 2021.1.1 #711

modiboa opened this issue May 4, 2021 · 4 comments

Comments

@modiboa
Copy link

modiboa commented May 4, 2021

The tests are running fine with mvn verify in the command line, but when I try to run using IntellJ I got the following error

Exception in thread "main" java.lang.StackOverflowError
	at mockit.internal.faking.FakeStates.getFakeState(FakeStates.java:93)
	at mockit.internal.faking.FakeInvocation.create(FakeInvocation.java:31)
	at org.junit.runner.notification.RunNotifier.fireTestRunStarted(RunNotifier.java)
	at mockit.integration.junit4.FakeRunNotifier.fireTestRunStarted(FakeRunNotifier.java:37)
	at org.junit.runner.notification.RunNotifier.fireTestRunStarted(RunNotifier.java)
	at mockit.integration.junit4.FakeRunNotifier.fireTestRunStarted(FakeRunNotifier.java:37)
	at org.junit.runner.notification.RunNotifier.fireTestRunStarted(RunNotifier.java)
	at mockit.integration.junit4.FakeRunNotifier.fireTestRunStarted(FakeRunNotifier.java:37)
	at org.junit.runner.notification.RunNotifier.fireTestRunStarted(RunNotifier.java)
	at mockit.integration.junit4.FakeRunNotifier.fireTestRunStarted(FakeRunNotifier.java:37)
	at org.junit.runner.notification.RunNotifier.fireTestRunStarted(RunNotifier.java)
	at mockit.integration.junit4.FakeRunNotifier.fireTestRunStarted(FakeRunNotifier.java:37)

Process finished with exit code 1

Junit 4.12

Anyone has any ideas?

@modiboa modiboa changed the title Issue with Jmockit 1.49 and IntellJ 2021.1.1 Issue with Jmockit 1.49 and IntelliJ 2021.1.1 May 4, 2021
@modiboa
Copy link
Author

modiboa commented May 4, 2021

After some testing, I found that if I set the maven-surefire-plugin configuration in the parent pom.xml I got the exception, but if I move the configuration to the child pom (module where the tests are) I can run fine with IntelliJ (Ctrl+Shit+F10).

My configuration:

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>
                        -javaagent:"${settings.localRepository}"/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar
                    </argLine>
                </configuration>
            </plugin>
        </plugins>
    </build>

ps: I tested adding the configuration inside parent pom <plugins> and <pluginManagement> as well...

@modiboa
Copy link
Author

modiboa commented May 4, 2021

It seems the root cause is when the project uses both maven-surefire-plugin and maven-failsafe-plugin with a configured <argLine>. I think what happens is that IntelliJ will automatically add the <argLine> from both plugins into the Test Runner.

If I disabled the argLine option I got the error of not found argLine. But If I enabled I got the exception above
Screenshot from 2021-05-04 16-01-26

@modiboa
Copy link
Author

modiboa commented May 4, 2021

I commented about this in the IntelliJ issue tracker https://youtrack.jetbrains.com/issue/IDEA-199109

@bilak
Copy link

bilak commented May 14, 2021

  • disable argLine parameter
  • try to configure your junit template to create each new test with vm options -ea -javaagent:/home/youruser/.m2/repository/org/jmockit/jmockit/1.49/jmockit-1.49.jar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants