title: Why is using static helper methods in Java bad?
body: <p>I'm asking because I'm trying to use a mocking framework (Mockito) which does not allow you to mock static methods. Looking into it I've found quite a few blog posts saying that you should have as few static methods as possible, but I'm having difficulty wrapping my head around why. Specifically why methods that don't modify the global state and are basically helper methods. For instance I have a class called <code>ApiCaller</code> that has several static methods. One of the static method's purpose is to execute an HTTP call, deal with any custom issues our server might have returned (ex. user not logged in) and return the response. To simplify, something like:</p>
  
  <pre><code>public class ApiCaller {
  ...
     public static String makeHttpCall(Url url) {
          // Performs logic to retrieve response and deal with custom server errors
          ...
          return response;
     }
  }
  </code></pre>
  
  <p>To use this all I have to do is call <code>ApiCaller.makeHttpCall(url)</code>
  Now I could easily make this a non static method like:</p>
  
  <pre><code>public class ApiCaller {
  ...
     public String makeHttpCall(Url url) {
          // Performs logic to retrieve response and deal with custom server errors
          ...
          return response;
     }
  }
  </code></pre>
  
  <p>and then to use this method call <code>new ApiCaller().makeHttpCall()</code> but this just seems like extra overhead. Can anyone explain why this is bad and if there is a better solution to making the methods non static (other than just removing the keyword) so that I can stub out these methods using the mocking framework?</p>
  
  <p>Thanks!</p>