title: spring 3 autowiring and junit testing
body: <p>My code:</p>
  
  <pre><code>@Component
  public class A {
      @Autowired
      private B b;
  
      public void method() {}
  }
  
  public interface X {...}
  
  @Component
  public class B implements X {
      ...
  }
  </code></pre>
  
  <p>I want to test in isolation class A. Do I have to mock class B? If yes, how? Because it is autowired and there is no setter where i could send the mocked object.</p>