String responseString=mock. Perform (MockMvcRequestBuilders. Post ("/user/login/noauth ")
CharacterEncoding (" utf-8 ")
ContentType (MediaType. APPLICATION_JSON). The content (requestJson. GetBytes ()))
AndExpect (MockMvcResultMatchers. The status (). IsOk ())
AndExpect (jsonPath (" $. RepMsg ", is (" success ")))
AndExpect (jsonPath (" $. RepCode ", is (" 0000 ")))
AndReturn (). The method getResponse (). GetContentAsString ();
JsonPath (" $. RepMsg ", is (" success "), the method is don't know which bag from the import, please expert advice,
CodePudding user response:
JsonPath and is are methods to define your own???????CodePudding user response:
JsonPath and is not their own definition,CodePudding user response:
AndExpect (jsonPath (" $. RepMsg ", is (" success ")))AndExpect (jsonPath (" $. RepCode ", is (" 0000 ")))/can not
CodePudding user response:
The import static org. Springframework. Test. Web. Servlet. Result. MockMvcResultMatchers. JsonPath;CodePudding user response:
The import static org. Hamcrest. CoreMatchers. Is;