class ExternalService {

    public String sendPostRequest(String body){
        String accessCode=getToken();
        String externalResponse="";
        if(accessCode==""){
            return "Invalid Access code provided";
        }

        try{
            String externalUrl="https://graph.facebook.com/v2.6/me/messages?access_token="+accessCode;
            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;
    }

}

class ExternalServiceTest {

    @Test
    public void sendPostRequest() {

//        fail();
    }

}