Unit testing

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset