I have a basic SpringBoot app. using Spring Initializer, embedded Tomcat, Thymeleaf template engine, and package as an executable JAR file.
I have this test:
@RunWith(SpringRunner.class)
@WebAppConfiguration
@WebMvcTest
public class MockMvcTests {
    // Pull in the application context created by @ContextConfiguration
    @Autowired
    private WebApplicationContext wac;
    private MockMvc mockMvc;
    @MockBean
    private I18NService i18NService;
    @MockBean
    private EmailService emailService;
    @MockBean
    private PasswordResetTokenService passwordResetTokenService;
    @MockBean
    private UserService userService;
    @MockBean
    private CompanyService companyService;
    @MockBean
    private UserSecurityService userSecurityService;
    @Before
    public void setup() {
        // Setup MockMVC to use our Spring Configuration
        this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
    }
    /**
     * 
     * @throws Exception
     *             If anything fails.
     */
    @Test
    public void getDeviceEventsTest() throws Exception {
        this.mockMvc
                .perform(get("/deviceevent/list") //
                .accept(MediaType.parseMediaType("text/html;charset=UTF-8")))
                .andExpect(status().isOk()) //
                .andExpect(model().size(1)); //
    }
But running the Test I got this Exception
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "#authorization.expression('hasRole(''ROLE_ADMIN'')')" (tdk/common/menu:62)
Is there a way to bypass the authorization ?
 
     
    