| Author |
How to Junit test a servlet method which has multipart form request.
|
Ravish Srivastava
Greenhorn
Joined: Sep 05, 2011
Posts: 14
|
|
Hi,
I have a method "doUploadFile(request, response)". This method accept multipart form request from a JSP file and save the file uploaded into to a local directory say C:/uploaded.
My Requiremnt is to Junit test doUploadFile() method.
How can I achieve this?
Help..
Thanks & Regards,
RS
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26184
|
|
|
Do you want to mock it out or call a framework that simulates the real behavior?
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Ravish Srivastava
Greenhorn
Joined: Sep 05, 2011
Posts: 14
|
|
|
I want to write a Java code which calls my "doUploadFile(request, response)" method. I want to construct a Multipart request so that I can pass to doUploadFile().
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26184
|
|
|
It sounds like you'd want a mock one then. You could write a class that extends it. Or use a mock one that already exists like Spring's MockMultipartHttpServletRequest.
|
 |
 |
|
|
subject: How to Junit test a servlet method which has multipart form request.
|
|
|