vendredi 25 août 2017

How to Test this kindof Controller using TestRestTemplate in springboot

@ApiRestController public class CityController extends 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);
}

}

Aucun commentaire:

Enregistrer un commentaire