spring boot开发笔记
单元测试 /** * 用户查询单测 * */ @Test public void whenQuerySuccess() throws Exception { String result = mockMvc .perform( get ( "/user" ) .param( "username" , "jojo" ) .param( "age" , "18" ) .param( "ageTo" , "60" ) .param( "xxx" , "yyy" ) // .param("size", "15") // .param("page", "3") // .param("sort", "age,desc") .contentType(MediaType. APPLICATION_JSON_UTF8 )) .andExpect( status ().isOk()) .andExpect( jsonPath ( "$.length()" ).value( 3 )) // 结果期望 .andReturn().getResponse().getContentAsString(); System. out .println(result); } @GetMapping @JsonView (User.UserSimpleView. class ) @ApiOperation (value =