HttpRequest { public HttpParameter[] getParameters() { return parameterList.toArray(new HttpParameter[parameterList.size()]); } 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 getParameters() throws Exception { { HttpRequestMethod httpRequestMethod = HttpRequestMethod.POST; String url = "http: String encoding = "utf-8"; HttpParameter[] parameters = new HttpParameter[0]; HttpRequest httpRequest = new HttpRequest(httpRequestMethod, url, encoding, parameters); assertThat(httpRequest.getParameters(), is(not(nullValue()))); assertThat(httpRequest.getParameters().length, is(0)); } { HttpRequestMethod httpRequestMethod = HttpRequestMethod.POST; String url = "http: String encoding = "utf-8"; HttpRequest httpRequest = new HttpRequest(httpRequestMethod, url, encoding); assertThat(httpRequest.getParameters(), is(not(nullValue()))); assertThat(httpRequest.getParameters().length, is(0)); } { HttpRequestMethod httpRequestMethod = HttpRequestMethod.POST; String url = "http: String encoding = "utf-8"; HttpParameter[] parameters = new HttpParameter[]{ new HttpParameter("key", "value") }; HttpRequest httpRequest = new HttpRequest(httpRequestMethod, url, encoding, parameters); 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.POST; String url = "http: 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.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")); } }