Test Class
@SpringBootTest
class TestClass {
@Mock
private WebClient.ResponseSpec responseMock;
@Test
public void testSampleMethod() {
//responseStr is valid json string
ResponseEntity<String> responseEntity = new ResponseEntity<String>(responseStr, HttpStatus.OK))
when(responseMock.toEntity(String.class)).thenReturn(responseEntity);
}
thenReturn() gives a compliation error - "Cannot resolve method 'thenReturn(org.springframework.http.ResponseEntity<java.lang.String>)'"
Is mocking ResponseEntity not allowed in Mockito? I can see an example of same here but it doesn't seem be to be accepted in my case. Is there any alternative way of mocking ResponseEntity.