Thanx, that was the solution to override the methods of the
BaseControllerTest in my FormControllerTest and just setting up the
RequestUri and the method.. now the test-web works successfully
Greetings..
hquinn wrote:
>
> Ok, I see... so that means that I need to override the methods of newGet
> and newPost of the BaseControllerTest??
> Mm any idea of how to do that? I saw the spring api for the
> MockMultipartHttpServletRequest and the constructor does not receive any
> parameters like the MockHttpServletRequest does to set the method ("POST"
> or "GET") and the RequestURI...
>
>
> Michael Horwitz wrote:
>>
>> You need to use MockMultipartHttpServletRequest in place of
>> MockHttpServletRequest.
>>
>> Mike.
>>
>> On 4/12/07, hquinn <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>> Hi everyone!
>>> I´m working with spring and appfuse... and I have a formController where
>>> I
>>> cast the request to a MultipartHttpServletRequest to upload a picture
>>> and
>>> save it in the database... when I test it manually in the web browser I
>>> have
>>> no problem with it, no errors... but when I run the test-web i get the
>>> next
>>> exception:
>>> Testcase:
>>> testSave(mx.edu.um.carz.webapp.action.ClientFormControllerTest):
>>> Caused an ERROR
>>> [junit] org.springframework.mock.web.MockHttpServletRequest cannot be
>>> cast to org.springframework.web.multipart.MultipartHttpServletRequest
>>> [junit] java.lang.ClassCastException:
>>> org.springframework.mock.web.MockHttpServletRequest cannot be cast to
>>> org.springframework.web.multipart.MultipartHttpServletRequest
>>> [junit] at
>>> mx.edu.um.carz.webapp.action.ClientFormController.onSubmit(
>>> ClientFormController.java:68)
>>> [junit] at
>>>
>>> org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission
>>> (SimpleFormController.java:258)
>>> [junit] at
>>> mx.edu.um.carz.webapp.action.BaseFormController.processFormSubmission(
>>> BaseFormController.java:139)
>>> [junit] at
>>>
>>> org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal
>>> (AbstractFormController.java:250)
>>> [junit] at
>>> org.springframework.web.servlet.mvc.AbstractController.handleRequest(
>>> AbstractController.java:153)
>>> [junit] at
>>> mx.edu.um.carz.webapp.action.ClientFormControllerTest.testSave(
>>> ClientFormControllerTest.java:42)
>>> [junit] at
>>> org.springframework.test.ConditionalTestCase.runBare(
>>> ConditionalTestCase.java:69)
>>>
>>> Any ideas why this happens?? It seems that there´s a problem when it
>>> tries
>>> to cast the MockHttpServletRequest but I dunno how to fix this in the
>>> tests.
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/problems-during-test-web-tf3566109s2369.html#a9961602
>>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/problems-during-test-web-tf3566109s2369.html#a9963917
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]