title: Spring boot test without database connection
body: <p>At first I had the following annotation above my test class: </p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @SpringBootTest(classes = Application.class)
  @AutoConfigureMockMvc
  </code></pre>
  
  <p>With that configuration it tries to connect to my database, which will give me this error if my database is not running:</p>
  
  <pre><code>com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  
  The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  </code></pre>
  
  <p>I would like my test to run without any connection to a database, which is why I tried to change the annotations, so my test class now looks like this: </p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @DataJpaTest
  @WebMvcTest(CitizenController.class)
  @AutoConfigureMockMvc
  public class CitizenControllerTest {
  
  @Autowired
  private MockMvc mockMvc;
  
  @MockBean
  private CitizenRepository citizenRepository;
  
  @MockBean
  private WeeklyCareRepository weeklyCareRepository;
  
  @MockBean
  private SubCategoryCareRepository subCategoryCareRepository;
  
  @Autowired
  private ObjectMapper objectMapper;
  
  private static List&lt;Citizen&gt; mockCitizenList;
  
  private String citizenJson;
  </code></pre>
  
  <p>However, I am now getting another error:</p>
  
  <pre><code>java.lang.IllegalStateException: Configuration error: found multiple declarations of @BootstrapWith for test class [controllers.CitizenControllerTest]: [@org.springframework.test.context.BootstrapWith(value=class org.springframework.boot.test.context.SpringBootTestContextBootstrapper), @org.springframework.test.context.BootstrapWith(value=class org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTestContextBootstrapper)]
  </code></pre>
  
  <p>Is it possible to run my test without a database connection? If so, what am I doing wrong/missing?</p>