title: Mock Multiple Static Methods
body: <p>I have a class like which makes two different static function calls one of which is some Util function while the other is local to the class, like this:</p>
  
  <pre><code>public class A {
      .
      .
      public static myfunc1() {
          obj1 = myfunc(param);
          .
          .
          Obj obj = Util.getObj(param);
          .
          .
      }
  
      static obj1 myfunc(param) {
          ..
      }
  }
  </code></pre>
  
  <p>I want to write unit test for this class which looks something like this:</p>
  
  <pre><code>public class Atest {
      .
      .
      public void testMyfunc1() {
          .
          .
          A a = new A();
          A spyA = spy(a);
          PowerMockito.doReturn(mockObj).when(spyA).myfunc(mockParam);
          .
          .
      }
      .
      .
  }
  </code></pre>
  
  <p>But it is giving me UnfinishedStubbingException.</p>
  
  <p>I also tried doing like this:</p>
  
  <pre><code>PowerMockito.when(spyA.myfunc(mockParam)).thenReturn(mockObj);
  </code></pre>
  
  <p>But it does not override the function.</p>
  
  <p><em>And secondly, I need to know that how can I override the Util.getObj() function.</em></p>