HttpRequest { public void addParameters(HttpParameter... parameters) { if (parameters == null) throw new IllegalArgumentException("parameters must not be null"); for (HttpParameter parameter : parameters) { addParameter(parameter); } } HttpRequest(HttpRequestMethod httpRequestMethod, String url, String content);  HttpRequest(HttpRequestMethod httpRequestMethod, String url, String encoding, String content);  HttpRequest(HttpRequestMethod httpRequestMethod, String url, HttpParameter... parameters);  HttpRequest(HttpRequestMethod httpRequestMethod, String url, String encoding, HttpParameter... parameters); HttpRequestMethod getHttpRequestMethod(); String getUrl(); HttpParameter[] getParameters(); void addParameters(HttpParameter... parameters); void addParameter(HttpParameter parameter); String getEncoding(); String getContent();  }
@Test public void addParameters() throws Exception { { HttpRequestMethod httpRequestMethod = HttpRequestMethod.GET; String url = "http: 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: 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")); } }