DEV Community

Discussion on: Testing SpringBoot Applications

Collapse
 
harshalwazarkar20 profile image
Harshad Wazarkar

Hi sir,
this is awesome article thank you so much it help a lot

but my application is secure with JWT and i want to perform unit test on controller using junit 5
so how can i mock the security context

Collapse
 
sivalabs profile image
K. Siva Prasad Reddy

We can use @WithMockUser from Spring Security Testing support for simulating authenticated user flow as described here docs.spring.io/spring-security/sit....

Collapse
 
harshalwazarkar20 profile image
Harshad Wazarkar

thank you sir for your replay.

i will try this