Commits

Anonymous committed 0187ece

improved unit test and fixed to use unix line break

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

Comments (0)

Files changed (2)

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

 /*
- * Created on Dec 24, 2005
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
  */
 package com.opensymphony.xwork.interceptor;
 
 import junit.framework.TestCase;
 
 /**
- * @author Gabe
+ * Unit test for {@link ParameterFilterInterceptor}.
  *
+ * @author Gabe
  */
 public class ParameterFilterInterceptorTest extends TestCase {
 
         mockInvocation.matchAndReturn("getAction", new SimpleAction());
         invocation = (ActionInvocation) mockInvocation.proxy();
         interceptor = new ParameterFilterInterceptor();
+        interceptor.init();
     }
-    
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        interceptor.destroy();
+    }
+
     public void testBasicBlockAll() throws Exception {
         runFilterTest(null,null,true,new String[] {"blah", "bladeblah", "bladebladeblah"});
-        assertEquals(0, getParameterNames().size()); 
+        assertEquals(0, getParameterNames().size());
     }
     
     public void testBasicAllowed() throws Exception {
     }
     
     private Collection getParameterNames() {
-        
         return ((Map)contextMap.get(ActionContext.PARAMETERS)).keySet();
     }
     
     public void runAction() throws Exception  {
         interceptor.intercept(invocation);
-        
     }
     
 }

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

 /*
- * Copyright (c) 2002-2003 by OpenSymphony
+ * Copyright (c) 2002-2006 by OpenSymphony
  * All rights reserved.
  */
 package com.opensymphony.xwork.interceptor;
 import com.opensymphony.xwork.*;
 import com.opensymphony.xwork.config.ConfigurationManager;
 import com.opensymphony.xwork.config.providers.MockConfigurationProvider;
+import com.opensymphony.xwork.mock.MockActionInvocation;
 import com.opensymphony.xwork.util.OgnlValueStack;
 import junit.framework.TestCase;
 
 
 
 /**
- * ParametersInterceptorTest
- * <p/>
- * Created : Jan 15, 2003 8:49:15 PM
+ * Unit test for {@link ParametersInterceptor}.
  *
  * @author Jason Carreira
  */
         assertTrue(((SimpleAction) proxy.getAction()).getActionMessages().isEmpty());
     }
 
-    public void testGetParameters() {
-        
+    public void testNoParametersAction() throws Exception {
+        ParametersInterceptor interceptor = new ParametersInterceptor();
+        interceptor.init();
+
+        MockActionInvocation mai = new MockActionInvocation();
+        Action action = new NoParametersAction();
+        mai.setAction(action);
+
+        interceptor.intercept(mai);
+        interceptor.destroy();
+    }
+
+    private class NoParametersAction implements Action, NoParameters {
+
+        public String execute() throws Exception {
+            return SUCCESS;
+        }
     }
 
     protected void setUp() throws Exception {