Update of /var/cvs/tests/vpro-wizards/org/mmbase/applications/vprowizards/spring
In directory
james.mmbase.org:/tmp/cvs-serv13996/tests/vpro-wizards/org/mmbase/applications/vprowizards/spring
Modified Files:
WizardControllerActionTest.java
Log Message:
work in progress
See also:
http://cvs.mmbase.org/viewcvs/tests/vpro-wizards/org/mmbase/applications/vprowizards/spring
Index: WizardControllerActionTest.java
===================================================================
RCS file:
/var/cvs/tests/vpro-wizards/org/mmbase/applications/vprowizards/spring/WizardControllerActionTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- WizardControllerActionTest.java 18 Aug 2008 19:17:33 -0000 1.1
+++ WizardControllerActionTest.java 8 Sep 2008 15:59:04 -0000 1.2
@@ -19,21 +19,23 @@
* <li>data binding</li>
* <li>error setting</li>
* </ul>
+ *
* @author Ernst Bunders
*
*/
public class WizardControllerActionTest extends TestCase {
- public void testController(){
- //create the wizard controller.
-// BeanFactory f = new XmlBeanFactory(new
ClassPathResource("org/mmbase/applications/vprowizards/spring/resources/vpro-wizards-servlet.test.xml"));
+ public void testController() {
+ // create the wizard controller.
+ // BeanFactory f = new XmlBeanFactory(new
+ //
ClassPathResource("org/mmbase/applications/vprowizards/spring/resources/vpro-wizards-servlet.test.xml"));
WizardController testController = createController();
-// create mock request and response objects.
+ // create mock request and response objects.
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new
MockHttpServletResponse();
- //create an instance of the test action class
+ // create an instance of the test action class
request.setParameter("actions[test][een].name", "hallo");
request.setParameter("actions[test][een].fields[een]", "een");
request.setParameter("actions[test][een].fields[twee]", "twee");
@@ -60,26 +62,26 @@
/**
* Test if the configuration reading is ok (for the controller).
*/
- public void testSpringConfiguration(){
+ public void testSpringConfiguration() {
WizardController wizardController = createApplicationContext();
assertEquals(wizardController.getViewResolver().getClass(),
ReferrerResolver.class);
CommandFactory commandFactory =
wizardController.getCommandFactory();
assertEquals(commandFactory.getClass(),
BasicCommandFactory.class);
- BasicCommandFactory basicCommandFactory =
(BasicCommandFactory)commandFactory;
- assertEquals(1, basicCommandFactory.getActionClasses().size());
+ BasicCommandFactory basicCommandFactory = (BasicCommandFactory)
commandFactory;
+ assertEquals(6, basicCommandFactory.getActionClasses().size());
assertEquals(TestAction.class,
basicCommandFactory.getActionClasses().get(0));
}
/**
* Test if the creation of an error is handeled well.
*/
- public void testError(){
+ public void testError() {
WizardController testController = createController();
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new
MockHttpServletResponse();
- //now try to make an error
+ // now try to make an error
request.setParameter("actions[test][een].error", "true");
try {
testController.handleRequest(request, response);
@@ -97,7 +99,7 @@
private WizardController createController() {
WizardController testController = new WizardController();
BasicCommandFactory cf = new BasicCommandFactory();
- List<Class<? extends Action>>actionClasses = new
ArrayList<Class<? extends Action>>();
+ List<Class<? extends Action>> actionClasses = new
ArrayList<Class<? extends Action>>();
actionClasses.add(TestAction.class);
cf.setActionClasses(actionClasses);
ReferrerResolver referrerResolver = new ReferrerResolver();
@@ -109,8 +111,9 @@
return testController;
}
- private WizardController createApplicationContext(){
- BeanFactory f = new XmlBeanFactory(new
ClassPathResource("org/mmbase/applications/vprowizards/spring/resources/vpro-wizards-servlet.test.xml"));
+ private WizardController createApplicationContext() {
+ BeanFactory f = new XmlBeanFactory(new ClassPathResource(
+
"org/mmbase/applications/vprowizards/spring/resources/vpro-wizards-servlet.test.xml"));
return (WizardController) f.getBean("wizardController");
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs