title: How to create test for post request
body: <p>I have a method which send <code>post</code> request in third party resource and returns <code>CloseableHttpResponse</code> result. I try (in first time)  to implement <code>junit</code> test for my project.. I know how to test methods which returns simple objects but I have no idea - how to possible similar test method? </p>
  
  <pre><code>public CloseableHttpResponse POST(String path, Map&lt;String, String&gt; parameters) throws URISyntaxException, IOException {
      List&lt;NameValuePair&gt; pairParameters = generateListOfNameValuePair(parameters);
      URI uri = new URIBuilder()
              .setScheme(SSL_SCHEME)
              .setHost(HOST)
              .setPath(path)
              .build();
      HttpRequestBase postMethod = new HttpPost(uri);
      try {
          ((HttpPost) postMethod).setEntity(new UrlEncodedFormEntity(pairParameters, "UTF-8"));
      } catch (UnsupportedEncodingException initE) {
          initE.printStackTrace();
      }
      return session.getHttpClient().execute(postMethod, session.getHttpContext());
  }
  </code></pre>