0

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);
Ryuzaki L
  • 37,302
  • 12
  • 68
  • 98
bubka85
  • 59
  • 5

0 Answers0