@Test
public void getUrl() throws Exception {

    {
        HttpRequestMethod httpRequestMethod = HttpRequestMethod.GET;
        String url = "http://example.com";
        String encoding = "utf-8";
        HttpParameter[] parameters = new HttpParameter[]{new HttpParameter("key", "value")};
        HttpRequest httpRequest = new HttpRequest(httpRequestMethod, url, encoding, parameters);
        assertThat(httpRequest.getUrl(), is("http://example.com?key=value"));
    }
    {
        HttpRequestMethod httpRequestMethod = HttpRequestMethod.GET;
        String url = "http://example.com";
        String encoding = "utf-8";
        HttpParameter[] parameters = new HttpParameter[]{
                new HttpParameter("key", "value"),
                new HttpParameter("key2", "value2")
        };
        HttpRequest httpRequest = new HttpRequest(httpRequestMethod, url, encoding, parameters);
        assertThat(httpRequest.getUrl(), is("http://example.com?key=value&key2=value2"));
    }
    {
        HttpRequestMethod httpRequestMethod = HttpRequestMethod.POST;
        String url = "http://example.com";
        String encoding = "utf-8";
        HttpParameter[] parameters = new HttpParameter[]{
                new HttpParameter("key", "value")
        };
        HttpRequest httpRequest = new HttpRequest(httpRequestMethod, url, encoding, parameters);
        assertThat(httpRequest.getUrl(), is("http://example.com"));
    }
}