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

Reply via email to