Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The accepted answer has fallen a little out of date regarding the links so it's worth mentioning the various solutions directly.</p> <p>To fix this problem do one of the following:</p> <p><strong>1 - Specifiy a javaagent</strong></p> <p>Add this to your JUnit execution environment (for your version):</p> <pre><code> -javaagent:path/to/your/jmockit/jmockit-0.998.jar </code></pre> <p><strong>2 - configure the Surefire plugin in Maven to avoid it</strong></p> <p>Add the following to your Maven configuration (choose your own versions)</p> <blockquote> <pre><code>&lt;!-- JMockit must be before JUnit in the classpath --&gt; &lt;dependency&gt; &lt;groupId&gt;mockit&lt;/groupId&gt; &lt;artifactId&gt;jmockit&lt;/artifactId&gt; &lt;/dependency&gt; &lt;!-- Standard unit testing --&gt; &lt;dependency&gt; &lt;groupId&gt;junit&lt;/groupId&gt; &lt;artifactId&gt;junit&lt;/artifactId&gt; &lt;/dependency&gt; </code></pre> </blockquote> <p>Ensure that your Surefire plugin is configured as follows (for your particular versions):</p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt; &lt;version&gt;2.4.3&lt;/version&gt; &lt;configuration&gt; &lt;argLine&gt;-javaagent:${settings.localRepository}/mockit/jmockit/0.998/jmockit-0.998.jar&lt;/argLine&gt; &lt;useSystemClassLoader&gt;true&lt;/useSystemClassLoader&gt; &lt;/configuration&gt; &lt;/plugin&gt; </code></pre> <p><strong>3 - Use the JUnit @RunWith annotation</strong></p> <p>Add this JUnit runner annotation on each and every test class</p> <pre><code>@RunWith(JMockit.class) public class ExampleTest {} </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload