We would not want to use security for our unit tests. The following code snippet shows how we can disable security for the unit test:
@RunWith(SpringRunner.class)
@WebMvcTest(value = TodoController.class, secure = false)
public class TodoControllerTest {
The key part is the secure = false parameter on the WebMvcTest annotation. This will disable Spring Security for the unit test.