this test case writing update
calls database:
@test public void testupdatelist() { // //... variables // httpheaders headers = new httpheaders(); headers.setcontenttype(mediatype.application_json); string requestbody = "{\"id\":\"" + givenid + "\",\"listname\":\"" + listname + "\",\"owner\":\"" + owner + "\"}"; httpentity <string> entity = new httpentity<>(requestbody, headers); // call update responseentity <tasklistresponse> list = template.exchange(request_url + "/list/update/{id}", httpmethod.put, entity, tasklistresponse.class, params); }
here params
name-value hashmap rest url.
when wanted update list
type, since resttemplate.put()
doesn't have return type, used http requests. call template.put
this:
template.put(request_url + "/list/update/{id}", request, params);
but don't know difference between 2 types of calls. explain me in reference above code? how can
template.exchange
return value, if it'sput
request?what i'm looking since used
template.post/get/delete
create()
,search()
,delete()
, should use.put()
update()
well, though won't response?
Comments
Post a Comment