title: Not able to mock static methods using Powermock (with EasyMock)
body: <p>I want to mock a static method and also non-static methods of a class.
    My source looks like:</p>
  
  <p><code><pre>
      public class XDSUtilityManager
      {<br>
          private static XDSUtilityManager xdsUtilMgr = new XDSUtilityManager();
          private XDSUtilityManager()
          {
              xdsUtilMgrImpl = new XDSUtilityManagerImpl();
          }<br>
          public static XDSUtilityManager getInstance()
          {
              return (xdsUtilMgr == null ) ? new XDSUtilityManager() : xdsUtilMgr;
          }
          public XMLDocument getXMLDocument(final String absoluteKey, final XDSClient xdsClient)
          {
              return getXMLDocument(absoluteKey, xdsClient, false);
          }
      }
  </code></pre></p>
  
  <p>I want to mock static method <strong>getInstance()</strong>. I want getInstance() to return mock object of <strong>XDSUtilityManager</strong> class.  Also I want to mock <strong>getXMLDocument()</strong> which is not static.</p>
  
  <p>And in my testCase I tried following:</p>
  
  <p><code><pre>
  XMLDocument xmlDocument = PowerMock.createMock(XMLDocument.class);<br>
  XDSUtilityManager xdsUtilityManager  = PowerMock.createPartialMock(XDSUtilityManager.class,"getXMLDocument");<br>
  PowerMock.mockStaticPartial(XDSUtilityManager.class, "getInstance");
  expect(XDSUtilityManager.getInstance()).andReturn(xdsUtilityManager).anyTimes();<br>
  expect(xdsUtilityManager.getXMLDocument((String)anyObject(), anyObject(XDSClient.class))).andReturn(xmlDocument).anyTimes();<br>
  PowerMock.replay(xdsUtilityManager);
  PowerMock.replay(xmlDocument);</p>
  
  <p></pre></code></p>
  
  <p>But things are not working as expected. Please help</p>