//如何發送@RequestParam值網址我使用TestRestTemplate與@RequestParam值來測試如何執行
enter code [email protected]
公共類CityController擴展BaseController {
@GetMapping("/cities")
public ResponseEntity<CitiesResponse> getAll(
@RequestParam(value = "pageNumber", defaultValue = "1") int pageNumber,
@RequestParam(value = "pageSize", defaultValue = "100") int pageSize,
@RequestParam(value = "sortBy", defaultValue = "id", required = false) String sortBy,
@RequestParam(value = "sortDirection", defaultValue = "asc", required = false) String sortDirection,
@RequestParam(value = "search", required = false) String search) {
return new ResponseEntity(cityService.getAll(pageNumber, pageSize, sortBy, sortDirection, search), HttpStatus.OK);
}
}
但在這個單元測試我送多@RequestParam與值(定義)並取回響應PAGENUMBER,pageSize的,sortBy,sortDirection ,搜索值 –
如何發送不帶請求的@RequestParam值(pojo類)? –