mockServer.verify();
}
@Test
public void testUpdate() throws Exception {
User user = new User();
user.setId(1L);
user.setName("zhang");
String uri = baseUri + "/{id}";
mockServer
.expect(requestTo(uri)) //验证请求URI
.andExpect(jsonPath("$.name").value(user.getName())) //验证请求的JSON数据
.andRespond(withNoContent()); //添加响应信息
restTemplate.setMessageConverters(Arrays.<HttpMessageConverter<?>>asList(new MappingJackson2HttpMessageConverter()));
ResponseEntity responseEntity = restTemplate.exchange(uri, HttpMethod.PUT, new HttpEntity<>(user), (Class) null, user.getId());
assertEquals(HttpStatus.NO_CONTENT, responseEntity.getStatusCode());
mockServer.verify();
}