How can I test the request json passed in restTemplate.postForEntity.
Lets say for the below method:
void doAsyncCall(Int id){
MyObject obj= mydao.getObject(id);
///do something
MyRequstObject myrequet = constructRequestfromObject(obj);// set some thing in request object form obj
Myresponse resp = restTemplate.postForEntity(url,new
HttpEntitiy(myrequet), respone.class)
if(resp.status==ok){
Logger.log("done");
}
}
AND in My test case:-
I want to test whats being passed to the postForEntity method in request.
1) Its more like am I passing the correct Object and its properties to the post call.
2) Do we have any way of accessing request JSON in JUNIT to check the contract of what being passed
Please help.