/** Test the return value of the PostMethod#removeParameter. */
  public void testRemoveParameterReturnValue() throws Exception {
    PostMethod method = new PostMethod("/");

    method.addParameter("param", "whatever");
    assertTrue(
        "Return value of the method is expected to be true", method.removeParameter("param"));
    assertFalse(
        "Return value of the method is expected to be false", method.removeParameter("param"));
  }
  /** Test that parameters can be added and removed. */
  public void testAddRemoveParametersToParamServlet() throws Exception {
    PostMethod method = new PostMethod("/");

    method.addParameter(new NameValuePair("pname0", "pvalue0"));
    method.addParameter(new NameValuePair("pname1", "pvalue1"));
    method.addParameter(new NameValuePair("pname2", "pvalue2"));
    method.addParameter(new NameValuePair("pname3", "pvalue3"));
    method.removeParameter("pname0");
    method.removeParameter("pname3");

    this.server.setHttpService(new EchoService());
    try {
      this.client.executeMethod(method);
      assertEquals(200, method.getStatusCode());
      String body = method.getResponseBodyAsString();
      assertEquals("pname1=pvalue1&pname2=pvalue2", body);
    } finally {
      method.releaseConnection();
    }
  }