Hi Brandon,

Maybe write your own ActionBeanPropertyBinder for those tests ? One that
sets the FileBean even if nothing is posted, depending on your testing
context ?

Looks a bit heavyweight but I can't think of anything else yet...

Cheers

Remi


2013/8/14 Brandon Goodin <brandon.goo...@gmail.com>

> I am in a situation where I need to write a unit test for a stripes action
> and the action supports a multipart form with a required file upload. I
> don't see how it is possible to use the MockRoundtrip and test file uploads
> with FileBean. What is the proper way to test Actions that back a
> multipart-form with files being passed in the request?
>
> Pseudo-code of my action:
>
> public class MyAction ... {
>
> @Validate(required = true)
> private FileBean file;
>
> public Resolution upload() {
>   ...
> }
>
> public void setFile(FileBean file) {
> this.file = file;
> }
>
> }
>
> For now I have decided to move the required=true off of the file property
> and simply manually validate in the body of the upload handler. This allows
> me to manually set the FileBean on the Action in my unit test before I call
> the mockRoundTrip.execute("upload");
>
> Please let me know if I'm missing something obvious.
>
> Thanks,
> Brandon Goodin
>
>
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to