I'm trying to mock the RestTemplate exchange below method but having issue
ResponseEntity<List<Stock>> response = restTemplate.exchange(UrlBatch, HttpMethod.POST, buildHttpEntity(reqBody), new ParameterizedTypeReference<List<Stock>>() {
});
I tried the below approach
ResponseEntity<List<Stock>> response=new ResponseEntity<List<Stock>>(HttpStatus.ACCEPTED);
Mockito.when(restTemplate.exchange(
ArgumentMatcher.eq("/objects/get-objectA"),
ArgumentMatcher.eq(HttpMethod.POST),
ArgumentMatcher.<HttpEntity<List<Stop>>>any(),
ArgumentMatcher.<ParameterizedTypeReference<List<Stock>>>any())
).thenReturn(response);