Anonymous avatar Anonymous committed 380cd7c

improved unit test, polished javadoc, removed unused imports

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk/src@977 e221344d-f017-0410-9bd5-d282ab1896d7

Comments (0)

Files changed (2)

java/com/opensymphony/xwork/interceptor/DefaultWorkflowInterceptor.java

 import com.opensymphony.xwork.ActionInvocation;
 import com.opensymphony.xwork.Validateable;
 import com.opensymphony.xwork.ValidationAware;
-import com.opensymphony.xwork.util.TextParseUtil;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.util.Collections;
-import java.util.Set;
-
-
 /**
  * <!-- START SNIPPET: description -->
  *
 	
 	private static final Log _log = LogFactory.getLog(DefaultWorkflowInterceptor.class);
 	
-    /**
-     * @see com.opensymphony.xwork.interceptor.MethodFilterInterceptor#doIntercept(com.opensymphony.xwork.ActionInvocation)
-     */
     protected String doIntercept(ActionInvocation invocation) throws Exception {
         Object action = invocation.getAction();
 
         if (action instanceof Validateable) {
             Validateable validateable = (Validateable) action;
             if (_log.isDebugEnabled()) {
-            	_log.debug("invoking validate() on action "+validateable);
+            	_log.debug("Invoking validate() on action "+validateable);
             }
             validateable.validate();
         }
 
             if (validationAwareAction.hasErrors()) {
             	if (_log.isDebugEnabled()) {
-            		_log.debug("errors on action "+validationAwareAction+", returning result name 'input'");
+            		_log.debug("Errors on action "+validationAwareAction+", returning result name 'input'");
             	}
                 return Action.INPUT;
             }

test/com/opensymphony/xwork/interceptor/DefaultWorkflowInterceptorTest.java

 /*
- * Copyright (c) 2002-2003 by OpenSymphony
+ * Copyright (c) 2002-2006 by OpenSymphony
  * All rights reserved.
  */
 package com.opensymphony.xwork.interceptor;
 
 
 /**
- * DefaultWorkflowInterceptorTest
+ * Unit test for {@link DefaultWorkflowInterceptor}.
  *
  * @author Jason Carreira
- *         Created Aug 29, 2003 1:51:00 PM
  */
 public class DefaultWorkflowInterceptorTest extends TestCase {
 
     private ActionInvocation invocation;
     private Mock actionMock;
     private Mock invocationMock;
-    private ValidateAction action;
+    private Action action;
 
 
     public void testInvokesActionInvocationIfNoErrors() throws Exception {
         assertEquals(result, interceptor.intercept(invocation));
     }
 
+    public void testNoValidateAction() throws Exception {
+        actionMock = new Mock(Action.class);
+        action = (Action) actionMock.proxy();
+
+        interceptor.setExcludeMethods("execute,input,validate");
+        interceptor.setIncludeMethods("execute");
+        final String result = "testing123";
+        invocationMock.expectAndReturn("invoke", result);
+        invocationMock.expectAndReturn("getAction", action);
+        assertEquals(result, interceptor.intercept(invocation));
+    }
+
     protected void setUp() throws Exception {
         super.setUp();
         actionMock = new Mock(ValidateAction.class);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.