title: PowerMock with final class System and static Method currentTimeMillis
body: <p>I do not understand why PowerMock do it this way.</p>
  
  <p>Test-Class</p>
  
  <pre><code>public class Testimpl {
      public long test() {
          long a = System.currentTimeMillis();
          System.out.println("2: " + a);
          return a;
      }
  }
  </code></pre>
  
  <p>jUnit-Class</p>
  
  <pre><code>import static org.mockito.MockitoAnnotations.initMocks;
  import org.junit.Before;
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.mockito.InjectMocks;
  import org.powermock.api.mockito.PowerMockito;
  import org.powermock.core.classloader.annotations.PrepareForTest;
  import org.powermock.modules.junit4.PowerMockRunner;
  
  @RunWith(PowerMockRunner.class)
  @PrepareForTest(System.class)
  public class TestimplTest {
  
      @InjectMocks
      Testimpl testimpl;
  
      @Before
      public void setUp() throws Exception {
          initMocks(testimpl);
          PowerMockito.mockStatic(System.class);
      }
  
      @Test
      public void test() {
          PowerMockito.when(System.currentTimeMillis()).thenReturn(12345l);
          System.out.println("1: " + System.currentTimeMillis());
          long a = testimpl.test();
          System.out.println("3: " + a);
      }
  
  }
  </code></pre>
  
  <p>Output:</p>
  
  <blockquote>
    <p>1: 12345</p>
    
    <p>2: 1422547577101</p>
    
    <p>3: 1422547577101</p>
  </blockquote>
  
  <p>Why this works PowerMock/Mockito correctly in the jUnit TestimplTest class and not in the tested Testimpl class?</p>
  
  <p>I use jUnit 4.11 and Mockito 1.9.5 with PowerMock 1.6.1.</p>
  
  <p>Thank you for your Help.</p>