title: Powermock - @SupressStaticInitializationFor is not working
body: <p>I have a class containing native methods and a static initializer which loads a dll and mocked it with powermock so that the the static initializer should be suppressed and the dll shouldn't be loaded.</p>
  
  <p>The class looks like this:</p>
  
  <pre class="lang-java prettyprint-override"><code>class UsbCommunication {
  
      static {
          //load some dll
      }
  
      public static native void nativeFunction();
  
  }
  </code></pre>
  
  <p>Under windows the tests are successfully executed using maven (in eclipse as well as cmd).
  But when I let our CI Server (a unix system) build the project all the tests get errors.</p>
  
  <p>The test looks like this:</p>
  
  <pre class="lang-java prettyprint-override"><code>@RunWith(PowerMockRunner.class)
  @SuppressStaticInitializationFor
      ("com.printerStatus.UsbCommunication")
  public class PrinterTest {
      //Test code
  }
  </code></pre>
  
  <p>Whats confusing for me is the fact that I get a java.lang.UnsatisfiedLinkError stating that the dll couldn't be loaded despite the fact that the static initializer should be suppressed.</p>
  
  <p><strong>Versions:</strong></p>
  
  <ul>
  <li>Mockito: 1.9.0</li>
  <li>PowerMock: 1.4.12</li>
  <li>JDK: 1.7</li>
  </ul>
  
  <p>Also I had to add this to the pom.xml as workaround for this problem: <a href="https://code.google.com/p/powermock/issues/detail?id=355" rel="nofollow">PowerMock Issue</a></p>
  
  <pre><code>&lt;profile&gt;
      &lt;id&gt;SplitVerifier&lt;/id&gt;
      &lt;activation&gt;
          &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
      &lt;/activation&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &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.12&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;argLine&gt;-XX:-UseSplitVerifier&lt;/argLine&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/profile&gt;
  </code></pre>
  
  <p>This is the stacktrace I get:</p>
  
  <pre><code>java.lang.UnsatisfiedLinkError: Can't load library
      at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1828)
      at java.lang.Runtime.load0(Runtime.java:792)
      at java.lang.System.load(System.java:1059)
      at de.kriegerit.tools.customPrinterStatusTools.CeSMLm.&lt;clinit&gt;(CeSMLm.java:9)
      at sun.reflect.GeneratedSerializationConstructorAccessor6.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
      at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:40)
      at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:59)
      at org.mockito.internal.creation.jmock.ClassImposterizer.createProxy(ClassImposterizer.java:111)
      at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:51)
      at org.powermock.api.mockito.internal.mockcreation.MockCreator.createMethodInvocationControl(MockCreator.java:100)
      at org.powermock.api.mockito.internal.mockcreation.MockCreator.mock(MockCreator.java:58)
      at org.powermock.api.mockito.PowerMockito.mockStatic(PowerMockito.java:70)
      at de.kriegerit.tools.customPrinterStatusTools.PrinterInterfaceTest.setup(PrinterInterfaceTest.java:42)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.junit.internal.runners.MethodRoadie.runBefores(MethodRoadie.java:129)
      at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:93)
      at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJUnit44RunnerDelegateImpl.java:296)
      at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTestInSuper(PowerMockJUnit47RunnerDelegateImpl.java:112)
      at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTest(PowerMockJUnit47RunnerDelegateImpl.java:73)
      at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runBeforesThenTestThenAfters(PowerMockJUnit44RunnerDelegateImpl.java:284)
      at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:84)
      at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
      at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:209)
      at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:148)
      at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:122)
      at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
      at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
      at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.run(PowerMockJUnit44RunnerDelegateImpl.java:120)
      at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:102)
      at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53)
      at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:42)
      at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:236)
      at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134)
      at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
      at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
      at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
      at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)
      at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
  </code></pre>
  
  <p>Is there any known issue or fix for this problem?</p>