Just disable security entirely. Add @ActiveProfiles(value = "test")
Service Test
Mock authorization if and only if the uut (unit under test) require it. For example viewAllReview will return all review in database if user is a SuperAdmin or return only their review if Admin.
Controller Test
Just disable security entirely. Add
@ActiveProfiles(value = "test")
Service Test
Mock authorization if and only if the uut (unit under test) require it. For example
viewAllReview
will return all review in database if user is a SuperAdmin or return only their review if Admin.Mocking authorization could be done by setting
SecurityContextHolder
. Basically just callTestHelper.loginAs*
(https://github.com/blibli-future/detroit/pull/31/commits/faaae5dfe22790f6bb150561773e8c9f40fe959e#diff-625d61011256f54c390262cecb67cdfd)