hi Rice
On 24/07/12 05:35, Rice Yeh wrote:
Hi,
I have a JaxRS resource class with method that has a HttpServletRequest
as one of its arguments like below
public Response post(
@FormParam(Parameters.METHOD) String method, // payment method's id
@Context HttpServletRequest servletRequest) throws InvocationException
I find the servletRequest is always null when testing with local transport.
Is it possible to pass the method a mocked servlet request?
I haven't tried yet - but passing the mocks with the direct invocation
mode should work fine. The question is what to do if one have
HttpServletRequest injected into a field. I think in this case a server
endpoint needs to have a test interceptor or filter which will set the
mock on the message (as AbstractHTTPDestination.HTTP_REQUEST).
Cheers, Sergey
Rice