@Test
public void addParameters() throws Exception {

    {
        HttpRequestMethod httpRequestMethod = HttpRequestMethod.GET;
        String url = "http://example.com";
        String encoding = "utf-8";
        HttpRequest httpRequest = new HttpRequest(httpRequestMethod, url, encoding);
        httpRequest.addParameters(new HttpParameter("key", "value"));
        assertThat(httpRequest.getParameters(), is(not(nullValue())));
        assertThat(httpRequest.getParameters().length, is(1));
        assertThat(httpRequest.getParameters()[0].getKey(), is("key"));
        assertThat(httpRequest.getParameters()[0].getValue(), is("value"));
    }
    {
        HttpRequestMethod httpRequestMethod = HttpRequestMethod.GET;
        String url = "http://example.com";
        String encoding = "utf-8";
        HttpRequest httpRequest = new HttpRequest(httpRequestMethod, url, encoding);
        httpRequest.addParameters(new HttpParameter("key", "value"), new HttpParameter("key2", "value2"));
        assertThat(httpRequest.getParameters(), is(not(nullValue())));
        assertThat(httpRequest.getParameters().length, is(2));
        assertThat(httpRequest.getParameters()[0].getKey(), is("key"));
        assertThat(httpRequest.getParameters()[0].getValue(), is("value"));
        assertThat(httpRequest.getParameters()[1].getKey(), is("key2"));
        assertThat(httpRequest.getParameters()[1].getValue(), is("value2"));
    }
}