users@jersey.java.net

[Jersey] Problems with post parameters in tests

From: Ludwig Magnusson <ludwig_at_itcatapult.com>
Date: Fri, 9 Mar 2012 20:55:43 +0100

Hi!

I am having some trouble with setting up my first test case for jersey. The problem is that post/get paramaters I want to use in my tests. None of the parameters are included in the HttpServlerRequest on the receiving side. Everything else works such as post/get, content types and the different paths.

I use the grizzly server for my tests.
My test class extends JerseyTest and this is the code for my test that sends the post:

WebResource webResource = resource().path("/mypath");
webResource.queryParam(“foo”, "bar");
String responseMsg = webResource.post(String.class);

I have also tried:

WebResource webResource = resource().path("/mypath");
Form form = new Form();
form.add(“foo”, “bar”);
String responseMsg = webResource.post(String.class, form)

Is there something worng with my tests?
/Ludwig