@Test
public void testFormResource() throws Exception
{
HttpClient client = new HttpClient();
PostMethod method = new PostMethod(TEST_URI);
method.addRequestHeader("custom-header", "42");
method.addParameter(BOOLEAN_VALUE_FIELD, "true");
method.addParameter(NAME_FIELD, "This is My Name");
method.addParameter(DOUBLE_VALUE_FIELD, "123.45");
method.addParameter(LONG_VALUE_FIELD, "566780");
method.addParameter(INTEGER_VALUE_FIELD, "3");
method.addParameter(SHORT_VALUE_FIELD, "12345");
int status = client.executeMethod(method);
Assert.assertEquals(HttpServletResponse.SC_OK, status);
InputStream response = method.getResponseBodyAsStream();
BufferedInputStream in = new BufferedInputStream(response);
String contentType = method.getResponseHeader("content-type").getValue();
Assert.assertEquals("application/x-www-form-urlencoded", contentType);
String formData = readString(in);
String[] keys = formData.split("&");
Map<String, String> values = new HashMap<String, String>();
for (String pair : keys)