title: Is there a way to not use @MockBean on Spring MVC tests?
body: <p>I'm trying to test the Rest contract of my Rest Controller using <code>@WebMvcTest</code>, like:</p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @WebMvcTest(MyController.class)
  class MyControllerTest {
  </code></pre>
  
  <p>The method that I'm testing use only MyFirstService, but inside the class there another two services (MySecondService and MyThirdService) used by two other methods.</p>
  
  <p>The problem is the use of <code>@MockBean</code>. The test class seems, in the final, like this:</p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @WebMvcTest(MyController.class)
  class MyControllerTest { 
  
      @MockBean
      private MyFirstService s1; // internal method mocked for the test
  
      @MockBean
      private MySecondService s2; //never used
  
      @MockBean
      private MyThirdService s3; //never used
  
      ...
  
      @Test
      public void testMethod() [
          // mock s1
          // calls rest controller method
          MvcResult mvcResult = mvc.perform(post("/products")
              .header("Content-Type", "application/json")
              .content(json))
              .andExpect(status().isCreated())
              .andReturn();
      }
  
  }
  </code></pre>
  
  <p>I think that this solution is not elegant with these annotations... The declared s2 and s3 appears to not be used from who read the code. And every service that is injected in the MyController needs to be there with <code>@MockBean</code>.</p>
  
  <p>So, I have two questions:</p>
  
  <ol>
  <li>Is there a way to not use <code>@MockBean</code> on Spring MVC tests?</li>
  <li>Is there a better way to do the same thing, even using <code>@MockBean</code>?</li>
  </ol>