Powermock mockstatic Cannot subclass final class
<p>I am trying to mock a final class</p>

<pre><code>PowerMockito.mockStatic(TestFinalClass.class);
</code></pre>

<p>It is working from my eclipse when I run a single junit and add javaagent to my VM arguments</p>

<pre><code>-javaagent:{path}/powermock-module-javaagent-1.6.4.jar
</code></pre>

<p>But when I try to run all test cases from command line using maven build command I am still getting "Cannot subclass final class"</p>

<p>Below is my snippet from pom.xml</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&lt;/version&gt;
            &lt;configuration&gt;
                &lt;argLine&gt;-javaagent:{path}/powermock-module-javaagent-1.6.4.jar&lt;/argLine&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;
</code></pre>