title: Are static methods a DI anti-pattern?
body: <p>I am a Java developer who is <em>beginning</em> to grasp the full power of dependency injections, and it suddenly dawned on me that there's no way to inject a static method. So it got me thinking: <strong>are static methods DI anti-patterns?</strong></p>
  
  <p>More importantly: if I were to embrace dependency injection, does this mean I need to stop coding static methods? I ask because there is no way to mock them and inject mock statics during unit tests, which is a huge turn-off for me.</p>
  
  <p><strong>Edit</strong>: I know that a common way to "wrap" and inject an existing static method is like this:</p>
  
  <pre><code>public class Foo {
      public static void bar() { ... }
  }
  
  public interface FooWrapper {
      public void bar();
  }
  
  public class FooWrapperImpl implements FooWrapper {
      public void bar() {
          return Foo.bar();
      }
  }
  </code></pre>
  
  <p>...but I'm not asking how to inject an existing static method...I'm asking if I should stop writing them altogether, if all my code (from this point forward) is going to embrace the notion of DI.</p>
  
  <p>Also, I see a lot of similarly-related questions to this, but couldn't find an exact match that asked this same question. If you see that it is indeed a dupe of another question, please point it out to me and I will close this question myself (please don't just closevote it!).</p>