当我的代码是这样的时会出现错误:
@Test
public void getTemplateByIdTest() throws Exception {
client.get().uri("/template/getTemplate/7")
.exchange()
.expectStatus().isOk()
.expectHeader().contentType(MediaType.APPLICATION_JSON_UTF8)
.expectBody(VtTemplateVO.class)
.returnResult();
}
当我像这样更改我的代码时,就可以了!
@Test
public void getTemplateByIdTest() throws Exception {
client.get().uri("/template/getTemplate/7")
.exchange()
.expectStatus().isOk()
.expectHeader().contentType(MediaType.APPLICATION_JSON_UTF8)
.expectBody(String.class)
.returnResult();
}
为什么我用的.expectBody(VtTemplateVO.class)时候会说org.springframework.web.reactive.function.UnsupportedMediaTypeException: Content type 'application/json;charset=UTF-8' not supported
有人知道吗?请帮忙,谢谢
相关分类