Hello, So after much documentation reading, example following, and head banging. I have seem to come to a dead end on trying to make unit tests work with stripes. I have one working fine and one not working fine and I really can't figure out why the one fails.
The one that fails gives me a validation-error message (that I format and print out): userId The value (1) entered in field User Id must be a valid number Now, from what I understand, '1' is a valid number, and should be a valid number, but stripes doesn't think so. Any suggestions/comments? Here is my MockServletContext context setup: MockServletContext context = new MockServletContext("test"); // Add the Stripes Filter Map<String, String> filterParams = new HashMap<String, String>(); filterParams.put("ActionResolver.Packages", "npsg.pl.ui"); filterParams.put("ActionBeanContext.Class", "npsg.pl.ui.PlActionBeanContext"); context.addFilter(StripesFilter.class, "StripesFilter", filterParams); // Add the Stripes Dispatcher filterParams = new HashMap<String, String>(); filterParams.put("url-pattern", "/action/*"); context.setServlet(DispatcherServlet.class, "StripesDispatcher",filterParams); Here is a unit test that works: MockRoundtrip trip = new MockRoundtrip(context, MessageActionBean.class); trip.setParameter("message", "test"); trip.execute(); MessageActionBean bean = trip.getActionBean(MessageActionBean.class); assertEquals("test",bean.getMessage()); assertEquals("/stripes-pages/message.jsp",trip.getDestination()); Along with the bean: @UrlBinding("/action/message") public class MessageActionBean extends PlActionBean { @Validate(required=true) private String message; public void setMessage(String message){this.message = message;} public String getMessage(){return message;} @DefaultHandler public Resolution view(){ return new ForwardResolution("/stripes-pages/message.jsp"); } } Here is a unit test that doesn't work: MockRoundtrip trip = new MockRoundtrip(context, UserActionBean.class); trip.addParameter("userId", "1"); trip.execute("view"); for(Entry<String, List<ValidationError>> entry : trip.getValidationErrors().entrySet()){ System.out.println(entry.getKey()); for(ValidationError error : entry.getValue()){ System.out.println("\t"+error.getMessage(Locale.getDefault())); } } assertEquals("/stripes-pages/display.jsp",trip.getDestination()); Along with the bean: @UrlBinding("/action/user/{$event}/{userId}") public class UserActionBean extends PlActionBean { private int userId; public int getUserId(){return userId;} public void setUserId(int userId){this.userId = userId;} public Resolution view(){ UserManager userManager = new UserManager(); User user = userManager.getUser(getUserId()); return new StreamingResolution("application/json",user.toJson()); } } Thanks for any and all help! ~Erik L ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm _______________________________________________ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users