【发布时间】:2021-09-14 18:48:38
【问题描述】:
Mockito.when(restTemplate.exchange(
anyString(),
Mockito.eq(HttpMethod.POST),
Mockito.any(),
Mockito.eq(String.class)
)).thenReturn(new ResponseEntity<>(HttpStatus.OK));
像上面一样在 JUnit 中模拟 restTemplate.exchange(POST 方法)。出现以下错误。
我做错了什么? 如何获得这张通行证?
【问题讨论】:
标签: java spring-boot junit resttemplate