title: PowerMock: mock out private static final variable, a concrete example
body: <p>what is the absolute minimal mocking that must be done to pass this test?</p>
  
  <p>code:</p>
  
  <pre><code>class PrivateStaticFinal {
      private static final Integer variable = 0;
      public static Integer method() { return variable + 1; }
  }
  </code></pre>
  
  <p>test:</p>
  
  <pre><code>@RunWith(PowerMockRunner.class)
  @PrepareForTest(PrivateStaticFinal.class)
  class PrivateStaticFinalTest {
      @Test
      public void testMethod() {
          //TODO PrivateStaticFinal.variable = 100
          assertEquals(PrivateStaticFinal.method(), 101);
      }
  }
  </code></pre>
  
  <p>related: <a href="https://stackoverflow.com/questions/19426999/mock-private-static-final-variables-in-the-testing-class">Mock private static final variables in the testing class</a> (no clear answer)</p>