I'm able to run tests against my rest-plugin classes with StrutsSpringTestCase, but none of the parameters are set on the action. For e.g.:
@Test
public void testAgegateParams() throws Exception {
request.setParameter("year", "2000");
request.setParameter("month", "01");
request.setParameter("day", "1");
ActionProxy proxy = getRestActionProxy("/agegate");
assertNotNull(proxy);
AgegateController action = (AgegateController) proxy.getAction();
assertNotNull(action);
String result = action.index();
assertEquals("returned result is not index", result, "index");
assertEquals(9, action.getAge());
}
I'm getting a failure on the final assertEquals(). Looking into the source of StrutsTestCase, the getActionProxy() has this:
ActionProxy proxy = config.getContainer().getInstance(ActionProxyFactory.class).createActionProxy(
namespace, name, method, new HashMap<String, Object>(), true, false);
But I'm pretty sure what I need is RestActionProxyFactory. If I attempt to duplicate the getActionProxy() method changing only this line to have RestActionProxyFactory.class, the getInstance call returns null.
Any ideas on how to get the container to return an instance of RestActionProxyFactory, or otherwise get this kind of test case to work against Rest actions?