RestfulApiClient { public T httpPost(final URI uri, final List<Pair<String, String>> params) throws IOException { if (null == uri) { logger.error(" unable to perform httpPost as the passed uri is null."); return null; } final HttpPost post = new HttpPost(uri); return this.sendAndReturn(completeRequest(post, params)); }  static URI buildUri(final String host, final int port, final String path,
      final boolean isHttp, final Pair<String, String>... params); T httpPost(final URI uri, final List<Pair<String, String>> params);  }
@Test public void testHttpPost() throws Exception { final MockRestfulApiClient mockClient = new MockRestfulApiClient(); final URI uri = MockRestfulApiClient.buildUri("test.com", 80, "test", true, new Pair<>("Entry1", "Value1")); final String content = "123456789"; final String result = mockClient.httpPost(uri, toPairList(content)); Assert.assertTrue(result != null && result.contains(uri.toString())); Assert.assertTrue(result.contains("METHOD = POST")); Assert.assertTrue(result.contains(String.format("%s = value=%s;", "BODY", content))); }