I'm using RestTemplate to call a rest controller from a controller, e.g.:
@RequestMapping(method = POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@ResponseBody
public String formForUpload(@RequestParam("file") MultipartFile file) throws Exception {
final MultiValueMap<String, Object> parts=...;
restTemplate.postForObject("http://localhost:8080/rest/something",
parts, MultipartFile.class);
...
}
How can I unit test that the URL called by the controller is correct. Is there any way to get the path for the rest controller (e.g. using such reflection technique)?
I don't want to run an integration test!
Aucun commentaire:
Enregistrer un commentaire