JUnit

In this tutorial, you will learn about @SpringBootTest annotation. You will use this annotation to write Integration Tests for your Spring Boot application. @SpringBootTest annotation is used to create a Spring Application Context that will be used during the test. It will make Spring Framework scan your application classes and look for different annotations. Depending…

Read More @SpringBootTest Annotation Example

In this blog post, you will learn the difference between @SpringBootTest and @WebMvcTest annotations. The main difference between the @SpringBootTest and @WebMvcTest annotations lies in the application context that they create. The @SpringBootTest annotation starts the full application context, which includes all the beans required for the application to function. On the other hand, the…

Read More Difference Between @SpringBootTest and @WebMvcTest

In this blog post, you will learn a couple of ways you can disable Spring Security Configuration for your @WebMvcTest. Disable Security Filters for @AutoConfigureMockMvc One of the ways you can disable Spring Security filters in your tests, is to use the @AutoConfigureMockMvc annotation. @AutoConfigureMockMvc annotation can be applied to a test class to enable…

Read More Disable Spring Security Configuration for @WebMvcTest

You will use @MockBean annotation to create and automatically add mocks to Spring ApplicationContext. In this tutorial, we will look at different ways you can use @MockBean annotation to create mocks. If you are testing your application with JUnit and Mockito, then there are many other useful tutorials you will find on the Testing Java Code…

Read More @MockBean Annotation Example