@ -60,6 +60,7 @@ import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.ResultMatcher ;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder ;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders ;
import org.springframework.test.web.servlet.result.MockMvcResultHandlers ;
import org.springframework.util.LinkedMultiValueMap ;
import org.springframework.util.MultiValueMap ;
import org.springframework.web.context.WebApplicationContext ;
@ -330,7 +331,14 @@ public abstract class AbstractWebTest extends AbstractInMemoryStorageTest {
if ( this . mockMvc = = null ) {
this . mockMvc = webAppContextSetup ( webApplicationContext )
. apply ( springSecurity ( ) ) . build ( ) ;
. apply ( springSecurity ( ) )
// conditional printing of non 2xx responses
. alwaysDo ( result - > {
if ( result . getResponse ( ) . getStatus ( ) > = 400 ) {
MockMvcResultHandlers . log ( ) . handle ( result ) ;
}
} )
. build ( ) ;
}
loginSysAdmin ( ) ;