Link to home
Start Free TrialLog in
Avatar of salmasri
salmasri

asked on

testing delete request

In my HttpServlet I have overriden the method doDelete(HttpServletRequest, HttpServletResponse). I need to write unit tests for that code. I am using HttpUnit for testing the get and post request. However, I couldn't find anything in httpunit regarding testing delete requests. Any one knows how it should be done?

If not, is there any other unit testing package that can handle delete requests in addition to get and post?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

What is a 'delete request'?
Avatar of salmasri
salmasri

ASKER

Oh i see - as in the opposite of PUT. That and DELETE are uncommonly implemented or supported
ASKER CERTIFIED SOLUTION
Avatar of tbboyett
tbboyett
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> In my HttpServlet I have overriden the method doDelete(HttpServletRequest, HttpServletResponse).

>Unless you have a specific reason to do this then you shouldn't.

Why not? I need to serve a delete request. If I didn't do it this way then I will just have to create a seperate "DeleteServlet" and in its doPost() I would do the deletion. But I think it would be cleaner to just override doDelete(), no?
> I need to serve a delete request.

What do you mean by a delete request?
The DELETE method requests that the origin server delete the resource identified by the Request-URI. If this is what you want then it is a "specific reason", if it is a more general delete request then a seperate interface may be more appropriate.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial