I'm using SpringBoot, gradle 5.5.1, intelliJ.
And I've written integration test with mockMvc
like following.
mockMvc.perform(put("/some/api)
.andDo(MockMvcResultHandler.print())
.andExpect(status().isOk())
.andExpect(jsonPath("$.success").value(true));
But I only can watch following response when unhandled exception occurred in my test
MockHttpServletRequest:
HTTP Method = POST
Request URI = /some/api
Parameters = {}
Headers = ...
Body = ...
Session Attrs = ...
Handler:
Type = ...
Method = ...
Async:
Async started = false
Async result = null
Resolved Exception:
Type = java.lang.NullPointerException
ModelAndView:
View name = null
View = null
Model = null
FlashMap:
Attributes = null
MockHttpServletResponse:
Status = 500
Error message = null
Headers = [Content-Type:"application/json;charset=UTF-8", X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0", X-Frame-Options:"DENY"]
Content type = application/json;charset=UTF-8
Body = {"error_code":"UNKNOWN","error_message":"UNKNOWN"}
Forwarded URL = null
Redirected URL = null
Cookies = []
As you see, I only can notice there is NullPointException
.
How can I watch full stacktrace?
question from:
https://stackoverflow.com/questions/66060581/cant-watch-stacktrace-on-mockmvc 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…