<I want to mock a method which will call the exter...
# stackoverflow
r
I want to mock a method which will call the external api in junit5 using mockito framework I am not able to stub the response for restTemplate.exchange(apiurl,HttpMethod.get,httpEntity,new PrametrizedTypeReference){}); public static List getTapPostList(HttpServletRequest request,String apiUrl, String xApiKey,HttpServletResponse response) { //HttpSession session = request.getSession(); //String idToken = (String) session.getAttribute("cognitoIdToken"); RestTemplate restTemplate = new RestTemplate(); HttpHeaders httpHeaders = new HttpHeaders();...