So the reference documentation suggests
@BeforeEach
void setup( WebApplicationContext wac) {
this.mockMvc = MockMvcBuilders.webAppContextSetup( wac )
.apply( SecurityMockMvcConfigurers.springSecurity() )
.alwaysDo( print() )
.build();
}
why not do it as constructor injection instead? (I haven't tried this, I'm just assuming it doesn't immediately blow up)
@Autowired
MyControllerTest(
@NonNull WebApplicatonContext wac
) {
this.mockMvc = MockMvcBuilders.webAppContextSetup( wac )
.apply( SecurityMockMvcConfigurers.springSecurity() )
.alwaysDo( print() )
.build();
}