【发布时间】:2017-01-05 08:00:19
【问题描述】:
这是我的控制器:
@RestController
@RequestMapping(value = Constants.COMPANY, produces = MediaType.APPLICATION_JSON_VALUE)
public class CompanyController {
@Autowired
private CompanyService companyService;
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity find(@ModelAttribute CompanyDto request, @Valid @ModelAttribute PageableRequestModel pageRequest) {
final Page<CompanyDto> dtoPg = companyService.find(request, pageRequest.getPageable());
return new ResponseEntity(PagedResponseDto.of(dtoPg), HttpStatus.OK);
}
}
这是我的控制器测试:
@Test
public void testListAll() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.get(COMPANY))
.andExpect(MockMvcResultMatchers.status().isOk());
}
为什么错误'嵌套异常是 java.lang.IllegalArgumentException: page required !' ??帮帮我
【问题讨论】:
-
您是如何设置测试的?它的配置是什么?能否请您发布完整的堆栈跟踪?
标签: java unit-testing spring-mvc junit controller