@Test public void sendPostRequest() { }
public String sendPostRequest(String body){ String accessCode=getToken(); String externalResponse=""; if(accessCode==""){ return "Invalid Access code provided"; } try{ String externalUrl="https: HttpHeaders headers=new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<String> httpEntity=new HttpEntity<String>(body,headers); RestTemplate template=new RestTemplate(); System.out.println(httpEntity.getBody()); externalResponse=template.postForObject(externalUrl,httpEntity,String.class); } catch (Exception ex){ ex.printStackTrace(); } return externalResponse; }
ExternalService { public String sendPostRequest(String body){ String accessCode=getToken(); String externalResponse=""; if(accessCode==""){ return "Invalid Access code provided"; } try{ String externalUrl="https: HttpHeaders headers=new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<String> httpEntity=new HttpEntity<String>(body,headers); RestTemplate template=new RestTemplate(); System.out.println(httpEntity.getBody()); externalResponse=template.postForObject(externalUrl,httpEntity,String.class); } catch (Exception ex){ ex.printStackTrace(); } return externalResponse; } }
ExternalService { public String sendPostRequest(String body){ String accessCode=getToken(); String externalResponse=""; if(accessCode==""){ return "Invalid Access code provided"; } try{ String externalUrl="https: HttpHeaders headers=new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<String> httpEntity=new HttpEntity<String>(body,headers); RestTemplate template=new RestTemplate(); System.out.println(httpEntity.getBody()); externalResponse=template.postForObject(externalUrl,httpEntity,String.class); } catch (Exception ex){ ex.printStackTrace(); } return externalResponse; }  }
ExternalService { public String sendPostRequest(String body){ String accessCode=getToken(); String externalResponse=""; if(accessCode==""){ return "Invalid Access code provided"; } try{ String externalUrl="https: HttpHeaders headers=new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<String> httpEntity=new HttpEntity<String>(body,headers); RestTemplate template=new RestTemplate(); System.out.println(httpEntity.getBody()); externalResponse=template.postForObject(externalUrl,httpEntity,String.class); } catch (Exception ex){ ex.printStackTrace(); } return externalResponse; }  String sendGetRequest(String url); String sendPostRequest(String body); String getToken(); String getLeagueStanding(int leagueID); String getLeagueFixture(int leagueID, int matchDay); }
ExternalService { public String sendPostRequest(String body){ String accessCode=getToken(); String externalResponse=""; if(accessCode==""){ return "Invalid Access code provided"; } try{ String externalUrl="https: HttpHeaders headers=new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<String> httpEntity=new HttpEntity<String>(body,headers); RestTemplate template=new RestTemplate(); System.out.println(httpEntity.getBody()); externalResponse=template.postForObject(externalUrl,httpEntity,String.class); } catch (Exception ex){ ex.printStackTrace(); } return externalResponse; }  String sendGetRequest(String url); String sendPostRequest(String body); String getToken(); String getLeagueStanding(int leagueID); String getLeagueFixture(int leagueID, int matchDay);  }