Unit test fails under unknown condition
---------------------------------------
Key: STS-755
URL: http://www.stripesframework.org/jira/browse/STS-755
Project: Stripes
Issue Type: Bug
Affects Versions: Release 1.5.3
Environment: Ubuntu Linux 10.04 x86_64
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)
Reporter: Eduardo Franceschi
Almost all my unit tests fails after I have changed stripes version from 1.5 to
1.5.3.
I have created a simple test to simulate the problem, but I cant find a
solution yet.
The test prints Param1={param1} instead of Param1=1 and the test fail.
@UrlBinding("/foo/{param1}/{$event}")
public class FooActionBean implements ActionBean {
private ActionBeanContext context;
@Validate(required = true)
private int param1;
@DefaultHandler
public Resolution bar() {
return new ForwardResolution("bar.jsp");
}
@Override
public ActionBeanContext getContext() {
return this.context;
}
public int getParam1() {
return this.param1;
}
@Override
public void setContext(ActionBeanContext context) {
this.context = context;
System.out.println("Param1=" +
context.getRequest().getParameter("param1"));
}
public void setParam1(int param1) {
this.param1 = param1;
}
}
public class FooActionBeanTest {
@Test
public void test() throws Exception {
MockServletContext context = new MockServletContext("test");
Map<String, String> filterParams = new HashMap<String,
String>();
filterParams.put("ActionResolver.Packages", "tld.domain");
context.addFilter(StripesFilter.class, "StripesFilter",
filterParams);
context.setServlet(DispatcherServlet.class,
"StripesDispatcher", null);
MockRoundtrip trip = new MockRoundtrip(context,
FooActionBean.class);
trip.setParameter("param1", "1");
trip.execute("foo");
FooActionBean bean = trip.getActionBean(FooActionBean.class);
assertEquals(1, bean.getParam1());
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development