title: How to mock an enum singleton class using Mockito/Powermock?
body: <p>I am unsure on how to mock an enum singleton class.</p>
  
  <pre><code>public enum SingletonObject{
    INSTANCE;
    private int num;
  
    protected setNum(int num) {
      this.num = num;
    }
  
    public int getNum() {
      return num;
    }
  </code></pre>
  
  <p>I'd like to stub getNum() in the above example, but I can't figure out how to mock the actual SingletonObject class.  I thought using Powermock to prepare the test would help since enums are inherently final.</p>
  
  <pre><code>//... rest of test code
  @Test
  public void test() {
    PowerMockito.mock(SingletonObject.class);
    when(SingletonObject.INSTANCE.getNum()).thenReturn(1); //does not work
  }
  </code></pre>
  
  <p>This is using PowerMockMockito 1.4.10 and Mockito 1.8.5.</p>