This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch WW-4173-disable
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 94a0c6e4258c920be89e9bde4273fe06fec17fc6
Author: Lukasz Lenart <[email protected]>
AuthorDate: Fri Oct 21 21:12:41 2022 +0200

    WW-4173 Adds support to disable processing a given interceptor
---
 .../xwork2/DefaultActionInvocation.java            |  26 +-
 .../xwork2/interceptor/AbstractInterceptor.java    |  14 +-
 .../xwork2/interceptor/Interceptor.java            |   7 +
 .../struts2/interceptor/CoepInterceptor.java       |   9 +-
 .../struts2/interceptor/CoopInterceptor.java       |   8 +-
 .../interceptor/FetchMetadataInterceptor.java      |   7 +-
 .../struts2/interceptor/csp/CspInterceptor.java    |   9 +-
 .../xwork2/DefaultActionInvocationTest.java        |  62 ++++-
 .../com/opensymphony/xwork2/TestInterceptor.java   |  89 -------
 .../config/providers/InterceptorBuilderTest.java   | 286 +++++++++------------
 .../providers/InterceptorForTestPurpose.java       |  51 ++--
 .../ServletDispatchedTestAssertInterceptor.java    |  56 ----
 12 files changed, 234 insertions(+), 390 deletions(-)

diff --git 
a/core/src/main/java/com/opensymphony/xwork2/DefaultActionInvocation.java 
b/core/src/main/java/com/opensymphony/xwork2/DefaultActionInvocation.java
index ea2076d4a..8c388d469 100644
--- a/core/src/main/java/com/opensymphony/xwork2/DefaultActionInvocation.java
+++ b/core/src/main/java/com/opensymphony/xwork2/DefaultActionInvocation.java
@@ -73,7 +73,7 @@ public class DefaultActionInvocation implements 
ActionInvocation {
     protected UnknownHandlerManager unknownHandlerManager;
     protected OgnlUtil ognlUtil;
     protected AsyncManager asyncManager;
-    protected Callable asyncAction;
+    protected Callable<?> asyncAction;
     protected WithLazyParams.LazyParamInjector lazyParamInjector;
 
     public DefaultActionInvocation(final Map<String, Object> extraContext, 
final boolean pushAction) {
@@ -101,7 +101,7 @@ public class DefaultActionInvocation implements 
ActionInvocation {
         this.container = cont;
     }
 
-    @Inject(required=false)
+    @Inject(required = false)
     public void setActionEventListener(ActionEventListener listener) {
         this.actionEventListener = listener;
     }
@@ -111,7 +111,7 @@ public class DefaultActionInvocation implements 
ActionInvocation {
         this.ognlUtil = ognlUtil;
     }
 
-    @Inject(required=false)
+    @Inject(required = false)
     public void setAsyncManager(AsyncManager asyncManager) {
         this.asyncManager = asyncManager;
     }
@@ -214,7 +214,7 @@ public class DefaultActionInvocation implements 
ActionInvocation {
         } catch (NullPointerException e) {
             LOG.debug("Got NPE trying to read result configuration for 
resultCode [{}]", resultCode);
         }
-        
+
         if (resultConfig == null) {
             // If no result is found for the given resultCode, try to get a 
wildcard '*' match.
             resultConfig = results.get("*");
@@ -248,7 +248,12 @@ public class DefaultActionInvocation implements 
ActionInvocation {
                 if (interceptor instanceof WithLazyParams) {
                     interceptor = lazyParamInjector.injectParams(interceptor, 
interceptorMapping.getParams(), invocationContext);
                 }
-                resultCode = 
interceptor.intercept(DefaultActionInvocation.this);
+                if (interceptor.isDisabled()) {
+                    LOG.debug("Interceptor: {} is disabled, skipping to next", 
interceptor.getClass().getSimpleName());
+                    resultCode = this.invoke();
+                } else {
+                    resultCode = 
interceptor.intercept(DefaultActionInvocation.this);
+                }
             } else {
                 resultCode = invokeActionOnly();
             }
@@ -268,9 +273,7 @@ public class DefaultActionInvocation implements 
ActionInvocation {
                 if (preResultListeners != null) {
                     LOG.trace("Executing PreResultListeners for result [{}]", 
result);
 
-                    for (Object preResultListener : preResultListeners) {
-                        PreResultListener listener = (PreResultListener) 
preResultListener;
-
+                    for (PreResultListener listener : preResultListeners) {
                         listener.beforeResult(this, resultCode);
                     }
                 }
@@ -314,7 +317,7 @@ public class DefaultActionInvocation implements 
ActionInvocation {
                 gripe = "Unable to instantiate Action, " + 
proxy.getConfig().getClassName() + ",  defined for '" + proxy.getActionName() + 
"' in namespace '" + proxy.getNamespace() + "'";
             }
 
-            gripe += (((" -- " + e.getMessage()) != null) ? e.getMessage() : " 
[no message in exception]");
+            gripe += e.getMessage();
             throw new StrutsException(gripe, e, proxy.getConfig());
         }
 
@@ -363,7 +366,7 @@ public class DefaultActionInvocation implements 
ActionInvocation {
             result.execute(this);
         } else if (resultCode != null && !Action.NONE.equals(resultCode)) {
             throw new ConfigurationException("No result defined for action " + 
getAction().getClass().getName()
-                    + " and result " + getResultCode(), proxy.getConfig());
+                + " and result " + getResultCode(), proxy.getConfig());
         } else {
             if (LOG.isDebugEnabled()) {
                 LOG.debug("No result returned for action {} at {}", 
getAction().getClass().getName(), proxy.getConfig().getLocation());
@@ -464,6 +467,7 @@ public class DefaultActionInvocation implements 
ActionInvocation {
 
     /**
      * Save the result to be used later.
+     *
      * @param actionConfig current ActionConfig
      * @param methodResult the result of the action.
      * @return the result code to process.
@@ -476,7 +480,7 @@ public class DefaultActionInvocation implements 
ActionInvocation {
             container.inject(explicitResult);
             return null;
         } else if (methodResult instanceof Callable) {
-            asyncAction = (Callable) methodResult;
+            asyncAction = (Callable<?>) methodResult;
             return null;
         } else {
             return (String) methodResult;
diff --git 
a/core/src/main/java/com/opensymphony/xwork2/interceptor/AbstractInterceptor.java
 
b/core/src/main/java/com/opensymphony/xwork2/interceptor/AbstractInterceptor.java
index 250d68098..2895bc0f0 100644
--- 
a/core/src/main/java/com/opensymphony/xwork2/interceptor/AbstractInterceptor.java
+++ 
b/core/src/main/java/com/opensymphony/xwork2/interceptor/AbstractInterceptor.java
@@ -25,21 +25,31 @@ import com.opensymphony.xwork2.ActionInvocation;
  */
 public abstract class AbstractInterceptor implements Interceptor {
 
+    private boolean disabled;
+
     /**
      * Does nothing
      */
     public void init() {
     }
-    
+
     /**
      * Does nothing
      */
     public void destroy() {
     }
 
-
     /**
      * Override to handle interception
      */
     public abstract String intercept(ActionInvocation invocation) throws 
Exception;
+
+    public void setDisabled(String disable) {
+        this.disabled = Boolean.parseBoolean(disable);
+    }
+
+    @Override
+    public boolean isDisabled() {
+        return this.disabled;
+    }
 }
diff --git 
a/core/src/main/java/com/opensymphony/xwork2/interceptor/Interceptor.java 
b/core/src/main/java/com/opensymphony/xwork2/interceptor/Interceptor.java
index cafa08fc0..c60c2f416 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/Interceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/Interceptor.java
@@ -219,4 +219,11 @@ public interface Interceptor extends Serializable {
      */
     String intercept(ActionInvocation invocation) throws Exception;
 
+    /**
+     * Allows to disable processing a given interceptor
+     *
+     * @return true if the given interceptor should be skipped
+     * @since 6.1.0
+     */
+    boolean isDisabled();
 }
diff --git 
a/core/src/main/java/org/apache/struts2/interceptor/CoepInterceptor.java 
b/core/src/main/java/org/apache/struts2/interceptor/CoepInterceptor.java
index 6f9df6e11..c887877dc 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/CoepInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/CoepInterceptor.java
@@ -47,12 +47,11 @@ public class CoepInterceptor extends AbstractInterceptor 
implements PreResultLis
     private static final String COEP_REPORT_HEADER = 
"Cross-Origin-Embedder-Policy-Report-Only";
 
     private final Set<String> exemptedPaths = new HashSet<>();
-    private boolean disabled = false;
     private String header = COEP_ENFORCING_HEADER;
 
     @Override
     public String intercept(ActionInvocation invocation) throws Exception {
-        if (disabled) {
+        if (this.isDisabled()) {
             LOG.trace("COEP interceptor has been disabled");
         } else {
             invocation.addPreResultListener(this);
@@ -62,7 +61,7 @@ public class CoepInterceptor extends AbstractInterceptor 
implements PreResultLis
 
     @Override
     public void beforeResult(ActionInvocation invocation, String resultCode) {
-        if (disabled) {
+        if (this.isDisabled()) {
             return;
         }
 
@@ -92,8 +91,4 @@ public class CoepInterceptor extends AbstractInterceptor 
implements PreResultLis
         }
     }
 
-    public void setDisabled(String value) {
-        disabled = Boolean.parseBoolean(value);
-    }
-
 }
diff --git 
a/core/src/main/java/org/apache/struts2/interceptor/CoopInterceptor.java 
b/core/src/main/java/org/apache/struts2/interceptor/CoopInterceptor.java
index ed1af3a04..5590ca98f 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/CoopInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/CoopInterceptor.java
@@ -49,12 +49,11 @@ public class CoopInterceptor extends AbstractInterceptor 
implements PreResultLis
     private static final String COOP_HEADER = "Cross-Origin-Opener-Policy";
 
     private final Set<String> exemptedPaths = new HashSet<>();
-    private boolean disabled = false;
     private String mode = SAME_ORIGIN;
 
     @Override
     public String intercept(ActionInvocation invocation) throws Exception {
-        if (disabled) {
+        if (this.isDisabled()) {
             LOG.trace("COOP interceptor has been disabled");
         } else {
             invocation.addPreResultListener(this);
@@ -64,7 +63,7 @@ public class CoopInterceptor extends AbstractInterceptor 
implements PreResultLis
 
     @Override
     public void beforeResult(ActionInvocation invocation, String resultCode) {
-        if (disabled) {
+        if (this.isDisabled()) {
             return;
         }
         HttpServletRequest request = 
invocation.getInvocationContext().getServletRequest();
@@ -95,7 +94,4 @@ public class CoopInterceptor extends AbstractInterceptor 
implements PreResultLis
         this.mode = mode;
     }
 
-    public void setDisabled(String value) {
-        this.disabled = Boolean.parseBoolean(value);
-    }
 }
diff --git 
a/core/src/main/java/org/apache/struts2/interceptor/FetchMetadataInterceptor.java
 
b/core/src/main/java/org/apache/struts2/interceptor/FetchMetadataInterceptor.java
index 5c119dd84..0122d718b 100644
--- 
a/core/src/main/java/org/apache/struts2/interceptor/FetchMetadataInterceptor.java
+++ 
b/core/src/main/java/org/apache/struts2/interceptor/FetchMetadataInterceptor.java
@@ -55,8 +55,6 @@ public class FetchMetadataInterceptor extends 
AbstractInterceptor {
     private final Set<String> exemptedPaths = new HashSet<>();
     private final ResourceIsolationPolicy resourceIsolationPolicy = new 
StrutsResourceIsolationPolicy();
 
-    private boolean disabled = false;
-
     @Inject(required = false)
     public void setExemptedPaths(String paths) {
         
this.exemptedPaths.addAll(TextParseUtil.commaDelimitedStringToSet(paths));
@@ -64,7 +62,7 @@ public class FetchMetadataInterceptor extends 
AbstractInterceptor {
 
     @Override
     public String intercept(ActionInvocation invocation) throws Exception {
-        if (disabled) {
+        if (this.isDisabled()) {
             LOG.trace("Fetch Metadata interceptor has been disabled");
             return invocation.invoke();
         }
@@ -111,7 +109,4 @@ public class FetchMetadataInterceptor extends 
AbstractInterceptor {
         response.setHeader(VARY_HEADER, VARY_HEADER_VALUE);
     }
 
-    public void setDisabled(String value) {
-        this.disabled = Boolean.parseBoolean(value);
-    }
 }
diff --git 
a/core/src/main/java/org/apache/struts2/interceptor/csp/CspInterceptor.java 
b/core/src/main/java/org/apache/struts2/interceptor/csp/CspInterceptor.java
index ecf9697a9..eb3ddb4a0 100644
--- a/core/src/main/java/org/apache/struts2/interceptor/csp/CspInterceptor.java
+++ b/core/src/main/java/org/apache/struts2/interceptor/csp/CspInterceptor.java
@@ -45,11 +45,9 @@ public final class CspInterceptor extends 
AbstractInterceptor implements PreResu
 
     private final CspSettings settings = new DefaultCspSettings();
 
-    private boolean disabled = false;
-
     @Override
     public String intercept(ActionInvocation invocation) throws Exception {
-        if (disabled) {
+        if (this.isDisabled()) {
             LOG.trace("CSP interceptor has been disabled");
         } else {
             invocation.addPreResultListener(this);
@@ -58,7 +56,7 @@ public final class CspInterceptor extends AbstractInterceptor 
implements PreResu
     }
 
     public void beforeResult(ActionInvocation invocation, String resultCode) {
-        if (disabled) {
+        if (this.isDisabled()) {
             return;
         }
         HttpServletRequest request = 
invocation.getInvocationContext().getServletRequest();
@@ -93,7 +91,4 @@ public final class CspInterceptor extends AbstractInterceptor 
implements PreResu
         settings.setEnforcingMode(enforcingMode);
     }
 
-    public void setDisabled(String value) {
-        this.disabled = Boolean.parseBoolean(value);
-    }
 }
diff --git 
a/core/src/test/java/com/opensymphony/xwork2/DefaultActionInvocationTest.java 
b/core/src/test/java/com/opensymphony/xwork2/DefaultActionInvocationTest.java
index a0d53c9b6..0d2ca8918 100644
--- 
a/core/src/test/java/com/opensymphony/xwork2/DefaultActionInvocationTest.java
+++ 
b/core/src/test/java/com/opensymphony/xwork2/DefaultActionInvocationTest.java
@@ -26,6 +26,8 @@ import com.opensymphony.xwork2.interceptor.PreResultListener;
 import com.opensymphony.xwork2.mock.MockActionProxy;
 import com.opensymphony.xwork2.mock.MockInterceptor;
 import com.opensymphony.xwork2.mock.MockResult;
+import com.opensymphony.xwork2.ognl.DefaultOgnlBeanInfoCacheFactory;
+import com.opensymphony.xwork2.ognl.DefaultOgnlExpressionCacheFactory;
 import com.opensymphony.xwork2.ognl.OgnlUtil;
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.util.ValueStackFactory;
@@ -90,6 +92,36 @@ public class DefaultActionInvocationTest extends 
XWorkTestCase {
         }
     }
 
+    public void testInvokeWithDisabledInterceptors() throws Exception {
+        // given
+        List<InterceptorMapping> interceptorMappings = new ArrayList<>();
+        MockInterceptor mockInterceptor1 = new MockInterceptor();
+        mockInterceptor1.setFoo("test1");
+        mockInterceptor1.setExpectedFoo("test1");
+        interceptorMappings.add(new InterceptorMapping("test1", 
mockInterceptor1));
+        MockInterceptor mockInterceptor2 = new MockInterceptor();
+        interceptorMappings.add(new InterceptorMapping("test2", 
mockInterceptor2));
+        mockInterceptor2.setDisabled("true");
+        MockInterceptor mockInterceptor3 = new MockInterceptor();
+        interceptorMappings.add(new InterceptorMapping("test3", 
mockInterceptor3));
+        mockInterceptor3.setFoo("test3");
+        mockInterceptor3.setExpectedFoo("test3");
+
+        // when
+        DefaultActionInvocation defaultActionInvocation = new 
DefaultActionInvocationTester(interceptorMappings);
+        container.inject(defaultActionInvocation);
+        defaultActionInvocation.stack = 
container.getInstance(ValueStackFactory.class).createValueStack();
+
+        defaultActionInvocation.setResultCode("");
+        defaultActionInvocation.invoke();
+
+        // then
+        assertTrue(mockInterceptor1.isExecuted());
+        assertFalse(mockInterceptor2.isExecuted());
+        assertTrue(mockInterceptor3.isExecuted());
+        assertTrue(defaultActionInvocation.isExecuted());
+    }
+
     public void testInvokingExistingExecuteMethod() throws Exception {
         // given
         DefaultActionInvocation dai = new 
DefaultActionInvocation(ActionContext.getContext().getContextMap(), false);
@@ -106,7 +138,7 @@ public class DefaultActionInvocationTest extends 
XWorkTestCase {
 
         dai.stack = 
container.getInstance(ValueStackFactory.class).createValueStack();
         dai.proxy = proxy;
-        dai.ognlUtil = new OgnlUtil();
+        dai.ognlUtil = createOgnlUtil();
 
         // when
         String result = dai.invokeAction(action, null);
@@ -138,7 +170,7 @@ public class DefaultActionInvocationTest extends 
XWorkTestCase {
 
         dai.stack = 
container.getInstance(ValueStackFactory.class).createValueStack();
         dai.proxy = proxy;
-        dai.ognlUtil = new OgnlUtil();
+        dai.ognlUtil = createOgnlUtil();
         dai.unknownHandlerManager = uhm;
 
         // when
@@ -154,7 +186,7 @@ public class DefaultActionInvocationTest extends 
XWorkTestCase {
         assertTrue(actual instanceof NoSuchMethodException);
     }
 
-    public void testInvokingExistingMethodThatThrowsException() throws 
Exception {
+    public void testInvokingExistingMethodThatThrowsException() {
         // given
         DefaultActionInvocation dai = new 
DefaultActionInvocation(ActionContext.getContext().getContextMap(), false);
         container.inject(dai);
@@ -170,7 +202,7 @@ public class DefaultActionInvocationTest extends 
XWorkTestCase {
 
         dai.stack = 
container.getInstance(ValueStackFactory.class).createValueStack();
         dai.proxy = proxy;
-        dai.ognlUtil = new OgnlUtil();
+        dai.ognlUtil = createOgnlUtil();
 
         // when
         Throwable actual = null;
@@ -185,7 +217,7 @@ public class DefaultActionInvocationTest extends 
XWorkTestCase {
         assertTrue(actual instanceof IllegalArgumentException);
     }
 
-    public void testUnknownHandlerManagerThatThrowsException() throws 
Exception {
+    public void testUnknownHandlerManagerThatThrowsException() {
         // given
         DefaultActionInvocation dai = new 
DefaultActionInvocation(ActionContext.getContext().getContextMap(), false);
         container.inject(dai);
@@ -207,7 +239,7 @@ public class DefaultActionInvocationTest extends 
XWorkTestCase {
 
         dai.stack = 
container.getInstance(ValueStackFactory.class).createValueStack();
         dai.proxy = proxy;
-        dai.ognlUtil = new OgnlUtil();
+        dai.ognlUtil = createOgnlUtil();
         dai.unknownHandlerManager = uhm;
 
         // when
@@ -224,7 +256,7 @@ public class DefaultActionInvocationTest extends 
XWorkTestCase {
         assertTrue(actual instanceof NoSuchMethodException);
     }
 
-    public void testUnknownHandlerManagerThatReturnsNull() throws Exception {
+    public void testUnknownHandlerManagerThatReturnsNull() {
         // given
         DefaultActionInvocation dai = new 
DefaultActionInvocation(ActionContext.getContext().getContextMap(), false);
         container.inject(dai);
@@ -246,7 +278,7 @@ public class DefaultActionInvocationTest extends 
XWorkTestCase {
 
         dai.stack = 
container.getInstance(ValueStackFactory.class).createValueStack();
         dai.proxy = proxy;
-        dai.ognlUtil = new OgnlUtil();
+        dai.ognlUtil = createOgnlUtil();
         dai.unknownHandlerManager = uhm;
 
         // when
@@ -284,7 +316,7 @@ public class DefaultActionInvocationTest extends 
XWorkTestCase {
 
         dai.stack = 
container.getInstance(ValueStackFactory.class).createValueStack();
         dai.proxy = proxy;
-        dai.ognlUtil = new OgnlUtil();
+        dai.ognlUtil = createOgnlUtil();
         dai.unknownHandlerManager = uhm;
 
         // when
@@ -376,7 +408,7 @@ public class DefaultActionInvocationTest extends 
XWorkTestCase {
         interceptorMappings.add(new InterceptorMapping("test1", 
mockInterceptor1));
         dai.interceptors = interceptorMappings.iterator();
 
-        dai.ognlUtil = new OgnlUtil();
+        dai.ognlUtil = createOgnlUtil();
 
         dai.invoke();
 
@@ -480,8 +512,14 @@ public class DefaultActionInvocationTest extends 
XWorkTestCase {
         loadConfigurationProviders(configurationProvider);
     }
 
+    private OgnlUtil createOgnlUtil() {
+        return new OgnlUtil(
+            new DefaultOgnlExpressionCacheFactory<>(),
+            new DefaultOgnlBeanInfoCacheFactory<>()
+        );
+    }
 
-    private class SimpleActionEventListener implements ActionEventListener {
+    private static class SimpleActionEventListener implements 
ActionEventListener {
 
         private final String name;
         private final String result;
@@ -507,7 +545,7 @@ public class DefaultActionInvocationTest extends 
XWorkTestCase {
 
 class DefaultActionInvocationTester extends DefaultActionInvocation {
     DefaultActionInvocationTester(List<InterceptorMapping> 
interceptorMappings) {
-        super(new HashMap<String, Object>(), false);
+        super(new HashMap<>(), false);
         interceptors = interceptorMappings.iterator();
         MockActionProxy actionProxy = new MockActionProxy();
         actionProxy.setMethod("execute");
diff --git a/core/src/test/java/com/opensymphony/xwork2/TestInterceptor.java 
b/core/src/test/java/com/opensymphony/xwork2/TestInterceptor.java
deleted file mode 100644
index 210cb7039..000000000
--- a/core/src/test/java/com/opensymphony/xwork2/TestInterceptor.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.opensymphony.xwork2;
-
-import com.opensymphony.xwork2.interceptor.Interceptor;
-import org.junit.Assert;
-
-
-/**
- * TestInterceptor
- *
- * @author Jason Carreira
- *         Created Apr 21, 2003 9:04:06 PM
- */
-public class TestInterceptor implements Interceptor {
-
-    public static final String DEFAULT_FOO_VALUE = "fooDefault";
-
-
-    private String expectedFoo = DEFAULT_FOO_VALUE;
-    private String foo = DEFAULT_FOO_VALUE;
-    private boolean executed = false;
-
-
-    public boolean isExecuted() {
-        return executed;
-    }
-
-    public void setExpectedFoo(String expectedFoo) {
-        this.expectedFoo = expectedFoo;
-    }
-
-    public String getExpectedFoo() {
-        return expectedFoo;
-    }
-
-    public void setFoo(String foo) {
-        this.foo = foo;
-    }
-
-    public String getFoo() {
-        return foo;
-    }
-
-    /**
-     * Called to let an interceptor clean up any resources it has allocated.
-     */
-    public void destroy() {
-    }
-
-    /**
-     * Called after an Interceptor is created, but before any requests are 
processed using the intercept() methodName. This
-     * gives the Interceptor a chance to initialize any needed resources.
-     */
-    public void init() {
-    }
-
-    /**
-     * Allows the Interceptor to do some processing on the request before 
and/or after the rest of the processing of the
-     * request by the DefaultActionInvocation or to short-circuit the 
processing and just return a String return code.
-     *
-     * @param invocation
-     * @return
-     * @throws Exception
-     */
-    public String intercept(ActionInvocation invocation) throws Exception {
-        executed = true;
-        Assert.assertNotSame(DEFAULT_FOO_VALUE, foo);
-        Assert.assertEquals(expectedFoo, foo);
-
-        return invocation.invoke();
-    }
-}
diff --git 
a/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorBuilderTest.java
 
b/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorBuilderTest.java
index a0ab50e86..d26b326c9 100644
--- 
a/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorBuilderTest.java
+++ 
b/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorBuilderTest.java
@@ -25,7 +25,7 @@ import 
com.opensymphony.xwork2.config.entities.InterceptorConfig;
 import com.opensymphony.xwork2.config.entities.InterceptorMapping;
 import com.opensymphony.xwork2.config.entities.InterceptorStackConfig;
 import com.opensymphony.xwork2.config.entities.PackageConfig;
-import com.opensymphony.xwork2.interceptor.Interceptor;
+import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
 
 import java.util.Collections;
 import java.util.LinkedHashMap;
@@ -33,9 +33,6 @@ import java.util.List;
 
 /**
  * <code>InterceptorBuilderTest</code>
- *
- * @author <a href="mailto:[email protected]";>Rainer Hermanns</a>
- * @version $Id$
  */
 public class InterceptorBuilderTest extends XWorkTestCase {
 
@@ -46,7 +43,7 @@ public class InterceptorBuilderTest extends XWorkTestCase {
         super.setUp();
         objectFactory = container.getInstance(ObjectFactory.class);
     }
-    
+
     /**
      * Try to test this
      * <interceptor-ref name="interceptorStack1">
@@ -55,91 +52,84 @@ public class InterceptorBuilderTest extends XWorkTestCase {
      * <param name="interceptor2.param1">interceptor2_value1</param>
      * <param name="interceptor2.param2">interceptor2_value2</param>
      * </interceptor-ref>
-     *
-     * @throws Exception
      */
-    public void testBuildInterceptor_1() throws Exception {
+    public void testBuildInterceptor_1() {
         InterceptorStackConfig interceptorStackConfig1 = new 
InterceptorStackConfig.Builder("interceptorStack1").build();
 
         InterceptorConfig interceptorConfig1 = new 
InterceptorConfig.Builder("interceptor1", 
"com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor1").build();
-
         InterceptorConfig interceptorConfig2 = new 
InterceptorConfig.Builder("interceptor2", 
"com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor2").build();
 
-
         PackageConfig packageConfig = new 
PackageConfig.Builder("package1").namespace("/namespace").addInterceptorConfig(interceptorConfig1).addInterceptorConfig(interceptorConfig2).addInterceptorStackConfig(interceptorStackConfig1).build();
 
-        List
-                interceptorMappings =
-                
InterceptorBuilder.constructInterceptorReference(packageConfig, 
"interceptorStack1",
-                        new LinkedHashMap<String, String>() {
-                            private static final long serialVersionUID = 
-1358620486812957895L;
-
-                            {
-                                put("interceptor1.param1", 
"interceptor1_value1");
-                                put("interceptor1.param2", 
"interceptor1_value2");
-                                put("interceptor2.param1", 
"interceptor2_value1");
-                                put("interceptor2.param2", 
"interceptor2_value2");
-                            }
-                        },null,  objectFactory);
+        List<InterceptorMapping> interceptorMappings =
+            InterceptorBuilder.constructInterceptorReference(packageConfig, 
"interceptorStack1",
+                new LinkedHashMap<String, String>() {
+                    {
+                        put("interceptor1.param1", "interceptor1_value1");
+                        put("interceptor1.param2", "interceptor1_value2");
+                        put("interceptor2.param1", "interceptor2_value1");
+                        put("interceptor2.param2", "interceptor2_value2");
+                    }
+                }, null, objectFactory);
 
         assertEquals(interceptorMappings.size(), 2);
 
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(0)).getName(), "interceptor1");
-        assertNotNull(((InterceptorMapping) 
interceptorMappings.get(0)).getInterceptor());
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(0)).getInterceptor().getClass(), 
MockInterceptor1.class);
-        assertEquals(((MockInterceptor1) ((InterceptorMapping) 
interceptorMappings.get(0)).getInterceptor()).getParam1(), 
"interceptor1_value1");
-        assertEquals(((MockInterceptor1) ((InterceptorMapping) 
interceptorMappings.get(0)).getInterceptor()).getParam2(), 
"interceptor1_value2");
-
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(1)).getName(), "interceptor2");
-        assertNotNull(((InterceptorMapping) 
interceptorMappings.get(1)).getInterceptor());
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(1)).getInterceptor().getClass(), 
MockInterceptor2.class);
-        assertEquals(((MockInterceptor2) ((InterceptorMapping) 
interceptorMappings.get(1)).getInterceptor()).getParam1(), 
"interceptor2_value1");
-        assertEquals(((MockInterceptor2) ((InterceptorMapping) 
interceptorMappings.get(1)).getInterceptor()).getParam2(), 
"interceptor2_value2");
+        assertEquals(interceptorMappings.get(0).getName(), "interceptor1");
+        assertNotNull(interceptorMappings.get(0).getInterceptor());
+        assertEquals(interceptorMappings.get(0).getInterceptor().getClass(), 
MockInterceptor1.class);
+        assertEquals(((MockInterceptor1) 
interceptorMappings.get(0).getInterceptor()).getParam1(), 
"interceptor1_value1");
+        assertEquals(((MockInterceptor1) 
interceptorMappings.get(0).getInterceptor()).getParam2(), 
"interceptor1_value2");
+
+        assertEquals(interceptorMappings.get(1).getName(), "interceptor2");
+        assertNotNull(interceptorMappings.get(1).getInterceptor());
+        assertEquals(interceptorMappings.get(1).getInterceptor().getClass(), 
MockInterceptor2.class);
+        assertEquals(((MockInterceptor2) 
interceptorMappings.get(1).getInterceptor()).getParam1(), 
"interceptor2_value1");
+        assertEquals(((MockInterceptor2) 
interceptorMappings.get(1).getInterceptor()).getParam2(), 
"interceptor2_value2");
     }
 
-    public void testMultipleSameInterceptors() throws Exception {
+    public void testMultipleSameInterceptors() {
         InterceptorConfig interceptorConfig1 = new 
InterceptorConfig.Builder("interceptor1", 
"com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor1").build();
         InterceptorConfig interceptorConfig2 = new 
InterceptorConfig.Builder("interceptor2", 
"com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor2").build();
 
         InterceptorStackConfig interceptorStackConfig1 = new 
InterceptorStackConfig.Builder("multiStack")
-                .addInterceptor(new 
InterceptorMapping(interceptorConfig1.getName(), 
objectFactory.buildInterceptor(interceptorConfig1, Collections.<String, 
String>emptyMap())))
-                .addInterceptor(new 
InterceptorMapping(interceptorConfig2.getName(), 
objectFactory.buildInterceptor(interceptorConfig2, Collections.<String, 
String>emptyMap())))
-                .addInterceptor(new 
InterceptorMapping(interceptorConfig1.getName(), 
objectFactory.buildInterceptor(interceptorConfig1, Collections.<String, 
String>emptyMap())))
-                .build();
+            .addInterceptor(new 
InterceptorMapping(interceptorConfig1.getName(), 
objectFactory.buildInterceptor(interceptorConfig1, Collections.emptyMap())))
+            .addInterceptor(new 
InterceptorMapping(interceptorConfig2.getName(), 
objectFactory.buildInterceptor(interceptorConfig2, Collections.emptyMap())))
+            .addInterceptor(new 
InterceptorMapping(interceptorConfig1.getName(), 
objectFactory.buildInterceptor(interceptorConfig1, Collections.emptyMap())))
+            .build();
 
         PackageConfig packageConfig = new PackageConfig.Builder("package1")
-                .namespace("/namespace")
-                .addInterceptorConfig(interceptorConfig1)
-                .addInterceptorConfig(interceptorConfig2)
-                .addInterceptorConfig(interceptorConfig1)
-                .addInterceptorStackConfig(interceptorStackConfig1)
-                .build();
-
-        List interceptorMappings =  
InterceptorBuilder.constructInterceptorReference(packageConfig, "multiStack",
-                        new LinkedHashMap<String, String>() {
-                            {
-                                put("interceptor1.param1", 
"interceptor1_value1");
-                                put("interceptor1.param2", 
"interceptor1_value2");
-                            }
-                        }, null,  objectFactory);
+            .namespace("/namespace")
+            .addInterceptorConfig(interceptorConfig1)
+            .addInterceptorConfig(interceptorConfig2)
+            .addInterceptorConfig(interceptorConfig1)
+            .addInterceptorStackConfig(interceptorStackConfig1)
+            .build();
+
+        List<InterceptorMapping> interceptorMappings = 
InterceptorBuilder.constructInterceptorReference(packageConfig, "multiStack",
+            new LinkedHashMap<String, String>() {
+                {
+                    put("interceptor1.param1", "interceptor1_value1");
+                    put("interceptor1.param2", "interceptor1_value2");
+                }
+            }, null, objectFactory);
 
         assertEquals(interceptorMappings.size(), 3);
 
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(0)).getName(), "interceptor1");
-        assertNotNull(((InterceptorMapping) 
interceptorMappings.get(0)).getInterceptor());
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(0)).getInterceptor().getClass(), 
MockInterceptor1.class);
-        assertEquals(((MockInterceptor1) ((InterceptorMapping) 
interceptorMappings.get(0)).getInterceptor()).getParam1(), 
"interceptor1_value1");
-        assertEquals(((MockInterceptor1) ((InterceptorMapping) 
interceptorMappings.get(0)).getInterceptor()).getParam2(), 
"interceptor1_value2");
-
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(1)).getName(), "interceptor2");
-        assertNotNull(((InterceptorMapping) 
interceptorMappings.get(1)).getInterceptor());
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(1)).getInterceptor().getClass(), 
MockInterceptor2.class);
-
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(2)).getName(), "interceptor1");
-        assertNotNull(((InterceptorMapping) 
interceptorMappings.get(2)).getInterceptor());
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(2)).getInterceptor().getClass(), 
MockInterceptor1.class);
-        assertEquals(((MockInterceptor1) ((InterceptorMapping) 
interceptorMappings.get(2)).getInterceptor()).getParam1(), 
"interceptor1_value1");
-        assertEquals(((MockInterceptor1) ((InterceptorMapping) 
interceptorMappings.get(2)).getInterceptor()).getParam2(), 
"interceptor1_value2");
+        assertEquals(interceptorMappings.get(0).getName(), "interceptor1");
+        assertNotNull(interceptorMappings.get(0).getInterceptor());
+        assertEquals(interceptorMappings.get(0).getInterceptor().getClass(), 
MockInterceptor1.class);
+        assertEquals(((MockInterceptor1) 
interceptorMappings.get(0).getInterceptor()).getParam1(), 
"interceptor1_value1");
+        assertEquals(((MockInterceptor1) 
interceptorMappings.get(0).getInterceptor()).getParam2(), 
"interceptor1_value2");
+
+        assertEquals(interceptorMappings.get(1).getName(), "interceptor2");
+        assertNotNull(interceptorMappings.get(1).getInterceptor());
+        assertEquals(interceptorMappings.get(1).getInterceptor().getClass(), 
MockInterceptor2.class);
+
+        assertEquals(interceptorMappings.get(2).getName(), "interceptor1");
+        assertNotNull(interceptorMappings.get(2).getInterceptor());
+        assertEquals(interceptorMappings.get(2).getInterceptor().getClass(), 
MockInterceptor1.class);
+        assertEquals(((MockInterceptor1) 
interceptorMappings.get(2).getInterceptor()).getParam1(), 
"interceptor1_value1");
+        assertEquals(((MockInterceptor1) 
interceptorMappings.get(2).getInterceptor()).getParam2(), 
"interceptor1_value2");
     }
 
     /**
@@ -150,53 +140,45 @@ public class InterceptorBuilderTest extends XWorkTestCase 
{
      * <param 
name="interceptorStack3.interceptor2.param1">interceptor2_value1</param>
      * <param 
name="interceptorStack3.interceptor2.param2">interceptor2_value2</param>
      * </interceptor-ref>
-     *
-     * @throws Exception
      */
-    public void testBuildInterceptor_2() throws Exception {
+    public void testBuildInterceptor_2() {
         InterceptorStackConfig interceptorStackConfig1 = new 
InterceptorStackConfig.Builder("interceptorStack1").build();
-
         InterceptorStackConfig interceptorStackConfig2 = new 
InterceptorStackConfig.Builder("interceptorStack2").build();
-
         InterceptorStackConfig interceptorStackConfig3 = new 
InterceptorStackConfig.Builder("interceptorStack3").build();
 
         InterceptorConfig interceptorConfig1 = new 
InterceptorConfig.Builder("interceptor1", 
"com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor1").build();
-
         InterceptorConfig interceptorConfig2 = new 
InterceptorConfig.Builder("interceptor2", 
"com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor2").build();
 
-
-        PackageConfig packageConfig = new 
PackageConfig.Builder("package1").namespace("/namspace").
-                addInterceptorConfig(interceptorConfig1).
-                addInterceptorConfig(interceptorConfig2).
-                addInterceptorStackConfig(interceptorStackConfig1).
-                addInterceptorStackConfig(interceptorStackConfig2).
-                addInterceptorStackConfig(interceptorStackConfig3).build();
-
-        List interceptorMappings = 
InterceptorBuilder.constructInterceptorReference(packageConfig, 
"interceptorStack1",
-                new LinkedHashMap<String, String>() {
-                    private static final long serialVersionUID = 
-5819935102242042570L;
-
-                    {
-                        put("interceptorStack2.interceptor1.param1", 
"interceptor1_value1");
-                        put("interceptorStack2.interceptor1.param2", 
"interceptor1_value2");
-                        put("interceptorStack3.interceptor2.param1", 
"interceptor2_value1");
-                        put("interceptorStack3.interceptor2.param2", 
"interceptor2_value2");
-                    }
-                }, null, objectFactory);
+        PackageConfig packageConfig = new 
PackageConfig.Builder("package1").namespace("/namespace").
+            addInterceptorConfig(interceptorConfig1).
+            addInterceptorConfig(interceptorConfig2).
+            addInterceptorStackConfig(interceptorStackConfig1).
+            addInterceptorStackConfig(interceptorStackConfig2).
+            addInterceptorStackConfig(interceptorStackConfig3).build();
+
+        List<InterceptorMapping> interceptorMappings = 
InterceptorBuilder.constructInterceptorReference(packageConfig, 
"interceptorStack1",
+            new LinkedHashMap<String, String>() {
+                {
+                    put("interceptorStack2.interceptor1.param1", 
"interceptor1_value1");
+                    put("interceptorStack2.interceptor1.param2", 
"interceptor1_value2");
+                    put("interceptorStack3.interceptor2.param1", 
"interceptor2_value1");
+                    put("interceptorStack3.interceptor2.param2", 
"interceptor2_value2");
+                }
+            }, null, objectFactory);
 
         assertEquals(interceptorMappings.size(), 2);
 
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(0)).getName(), "interceptor1");
-        assertNotNull(((InterceptorMapping) 
interceptorMappings.get(0)).getInterceptor());
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(0)).getInterceptor().getClass(), 
MockInterceptor1.class);
-        assertEquals(((MockInterceptor1) ((InterceptorMapping) 
interceptorMappings.get(0)).getInterceptor()).getParam1(), 
"interceptor1_value1");
-        assertEquals(((MockInterceptor1) ((InterceptorMapping) 
interceptorMappings.get(0)).getInterceptor()).getParam2(), 
"interceptor1_value2");
-
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(1)).getName(), "interceptor2");
-        assertNotNull(((InterceptorMapping) 
interceptorMappings.get(1)).getInterceptor());
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(1)).getInterceptor().getClass(), 
MockInterceptor2.class);
-        assertEquals(((MockInterceptor2) ((InterceptorMapping) 
interceptorMappings.get(1)).getInterceptor()).getParam1(), 
"interceptor2_value1");
-        assertEquals(((MockInterceptor2) ((InterceptorMapping) 
interceptorMappings.get(1)).getInterceptor()).getParam2(), 
"interceptor2_value2");
+        assertEquals(interceptorMappings.get(0).getName(), "interceptor1");
+        assertNotNull(interceptorMappings.get(0).getInterceptor());
+        assertEquals(interceptorMappings.get(0).getInterceptor().getClass(), 
MockInterceptor1.class);
+        assertEquals(((MockInterceptor1) 
interceptorMappings.get(0).getInterceptor()).getParam1(), 
"interceptor1_value1");
+        assertEquals(((MockInterceptor1) 
interceptorMappings.get(0).getInterceptor()).getParam2(), 
"interceptor1_value2");
+
+        assertEquals(interceptorMappings.get(1).getName(), "interceptor2");
+        assertNotNull(interceptorMappings.get(1).getInterceptor());
+        assertEquals(interceptorMappings.get(1).getInterceptor().getClass(), 
MockInterceptor2.class);
+        assertEquals(((MockInterceptor2) 
interceptorMappings.get(1).getInterceptor()).getParam1(), 
"interceptor2_value1");
+        assertEquals(((MockInterceptor2) 
interceptorMappings.get(1).getInterceptor()).getParam2(), 
"interceptor2_value2");
     }
 
     /**
@@ -207,72 +189,53 @@ public class InterceptorBuilderTest extends XWorkTestCase 
{
      * <param 
name="interceptorStack5.interceptor2.param1">interceptor2_value1</param>
      * <param 
name="interceptorStack5.interceptor2.param2">interceptor2_value2</param>
      * </interceptor-ref>
-     *
-     * @throws Exception
      */
-    public void testBuildInterceptor_3() throws Exception {
+    public void testBuildInterceptor_3() {
         InterceptorConfig interceptorConfig1 = new 
InterceptorConfig.Builder("interceptor1", 
"com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor1").build();
-
         InterceptorConfig interceptorConfig2 = new 
InterceptorConfig.Builder("interceptor2", 
"com.opensymphony.xwork2.config.providers.InterceptorBuilderTest$MockInterceptor2").build();
 
-
         InterceptorStackConfig interceptorStackConfig1 = new 
InterceptorStackConfig.Builder("interceptorStack1").build();
-
-
         InterceptorStackConfig interceptorStackConfig2 = new 
InterceptorStackConfig.Builder("interceptorStack2").build();
-
-
         InterceptorStackConfig interceptorStackConfig3 = new 
InterceptorStackConfig.Builder("interceptorStack3").build();
-
-
         InterceptorStackConfig interceptorStackConfig4 = new 
InterceptorStackConfig.Builder("interceptorStack4").build();
-
-
         InterceptorStackConfig interceptorStackConfig5 = new 
InterceptorStackConfig.Builder("interceptorStack5").build();
 
-
-
         PackageConfig packageConfig = new PackageConfig.Builder("package1").
-                addInterceptorConfig(interceptorConfig1).
-                addInterceptorConfig(interceptorConfig2).
-                addInterceptorStackConfig(interceptorStackConfig1).
-                addInterceptorStackConfig(interceptorStackConfig2).
-                addInterceptorStackConfig(interceptorStackConfig3).
-                addInterceptorStackConfig(interceptorStackConfig4).
-                addInterceptorStackConfig(interceptorStackConfig5).build();
-
-
-        List interceptorMappings = 
InterceptorBuilder.constructInterceptorReference(
-                packageConfig, "interceptorStack1",
-                new LinkedHashMap<String, String>() {
-                    private static final long serialVersionUID = 
4675809753780875525L;
-
-                    {
-                        
put("interceptorStack2.interceptorStack3.interceptorStack4.interceptor1.param1",
 "interceptor1_value1");
-                        
put("interceptorStack2.interceptorStack3.interceptorStack4.interceptor1.param2",
 "interceptor1_value2");
-                        put("interceptorStack5.interceptor2.param1", 
"interceptor2_value1");
-                        put("interceptorStack5.interceptor2.param2", 
"interceptor2_value2");
-                    }
-                }, null, objectFactory);
+            addInterceptorConfig(interceptorConfig1).
+            addInterceptorConfig(interceptorConfig2).
+            addInterceptorStackConfig(interceptorStackConfig1).
+            addInterceptorStackConfig(interceptorStackConfig2).
+            addInterceptorStackConfig(interceptorStackConfig3).
+            addInterceptorStackConfig(interceptorStackConfig4).
+            addInterceptorStackConfig(interceptorStackConfig5).build();
+
+        List<InterceptorMapping> interceptorMappings = 
InterceptorBuilder.constructInterceptorReference(
+            packageConfig, "interceptorStack1",
+            new LinkedHashMap<String, String>() {
+                {
+                    
put("interceptorStack2.interceptorStack3.interceptorStack4.interceptor1.param1",
 "interceptor1_value1");
+                    
put("interceptorStack2.interceptorStack3.interceptorStack4.interceptor1.param2",
 "interceptor1_value2");
+                    put("interceptorStack5.interceptor2.param1", 
"interceptor2_value1");
+                    put("interceptorStack5.interceptor2.param2", 
"interceptor2_value2");
+                }
+            }, null, objectFactory);
 
         assertEquals(interceptorMappings.size(), 2);
 
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(0)).getName(), "interceptor1");
-        assertNotNull(((InterceptorMapping) 
interceptorMappings.get(0)).getInterceptor());
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(0)).getInterceptor().getClass(), 
MockInterceptor1.class);
-        assertEquals(((MockInterceptor1) ((InterceptorMapping) 
interceptorMappings.get(0)).getInterceptor()).getParam1(), 
"interceptor1_value1");
-        assertEquals(((MockInterceptor1) ((InterceptorMapping) 
interceptorMappings.get(0)).getInterceptor()).getParam2(), 
"interceptor1_value2");
-
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(1)).getName(), "interceptor2");
-        assertNotNull(((InterceptorMapping) 
interceptorMappings.get(1)).getInterceptor());
-        assertEquals(((InterceptorMapping) 
interceptorMappings.get(1)).getInterceptor().getClass(), 
MockInterceptor2.class);
-        assertEquals(((MockInterceptor2) ((InterceptorMapping) 
interceptorMappings.get(1)).getInterceptor()).getParam1(), 
"interceptor2_value1");
-        assertEquals(((MockInterceptor2) ((InterceptorMapping) 
interceptorMappings.get(1)).getInterceptor()).getParam2(), 
"interceptor2_value2");
+        assertEquals(interceptorMappings.get(0).getName(), "interceptor1");
+        assertNotNull(interceptorMappings.get(0).getInterceptor());
+        assertEquals(interceptorMappings.get(0).getInterceptor().getClass(), 
MockInterceptor1.class);
+        assertEquals(((MockInterceptor1) 
interceptorMappings.get(0).getInterceptor()).getParam1(), 
"interceptor1_value1");
+        assertEquals(((MockInterceptor1) 
interceptorMappings.get(0).getInterceptor()).getParam2(), 
"interceptor1_value2");
+
+        assertEquals(interceptorMappings.get(1).getName(), "interceptor2");
+        assertNotNull(interceptorMappings.get(1).getInterceptor());
+        assertEquals(interceptorMappings.get(1).getInterceptor().getClass(), 
MockInterceptor2.class);
+        assertEquals(((MockInterceptor2) 
interceptorMappings.get(1).getInterceptor()).getParam1(), 
"interceptor2_value1");
+        assertEquals(((MockInterceptor2) 
interceptorMappings.get(1).getInterceptor()).getParam2(), 
"interceptor2_value2");
     }
 
-
-    public static class MockInterceptor1 implements Interceptor {
-        private static final long serialVersionUID = 2939902550126175874L;
+    public static class MockInterceptor1 extends AbstractInterceptor {
         private String param1;
         private String param2;
 
@@ -292,19 +255,12 @@ public class InterceptorBuilderTest extends XWorkTestCase 
{
             return this.param2;
         }
 
-        public void destroy() {
-        }
-
-        public void init() {
-        }
-
         public String intercept(ActionInvocation invocation) throws Exception {
             return invocation.invoke();
         }
     }
 
-    public static class MockInterceptor2 implements Interceptor {
-        private static final long serialVersionUID = 267427973306989618L;
+    public static class MockInterceptor2 extends AbstractInterceptor {
         private String param1;
         private String param2;
 
@@ -324,12 +280,6 @@ public class InterceptorBuilderTest extends XWorkTestCase {
             return this.param2;
         }
 
-        public void destroy() {
-        }
-
-        public void init() {
-        }
-
         public String intercept(ActionInvocation invocation) throws Exception {
             return invocation.invoke();
         }
diff --git 
a/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorForTestPurpose.java
 
b/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorForTestPurpose.java
index 6fb798c21..bca455bae 100644
--- 
a/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorForTestPurpose.java
+++ 
b/core/src/test/java/com/opensymphony/xwork2/config/providers/InterceptorForTestPurpose.java
@@ -19,32 +19,31 @@
 package com.opensymphony.xwork2.config.providers;
 
 import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.interceptor.Interceptor;
+import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
 
-/**
- * 
- * @author tm_jee
- * @version $Date$ $Id$
- */
-public class InterceptorForTestPurpose implements Interceptor {
-
-       private String paramOne;
-       private String paramTwo;
-       
-       public String getParamOne() { return paramOne; }
-       public void setParamOne(String paramOne) { this.paramOne = paramOne; }
-       
-       public String getParamTwo() { return paramTwo; }
-       public void setParamTwo(String paramTwo) { this.paramTwo = paramTwo; }
-       
-       public void destroy() {
-       }
-
-       public void init() {
-       }
-
-       public String intercept(ActionInvocation invocation) throws Exception {
-               return invocation.invoke();
-       }
+public class InterceptorForTestPurpose extends AbstractInterceptor {
+
+    private String paramOne;
+    private String paramTwo;
+
+    public String getParamOne() {
+        return paramOne;
+    }
+
+    public void setParamOne(String paramOne) {
+        this.paramOne = paramOne;
+    }
+
+    public String getParamTwo() {
+        return paramTwo;
+    }
+
+    public void setParamTwo(String paramTwo) {
+        this.paramTwo = paramTwo;
+    }
+
+    public String intercept(ActionInvocation invocation) throws Exception {
+        return invocation.invoke();
+    }
 
 }
diff --git 
a/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatchedTestAssertInterceptor.java
 
b/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatchedTestAssertInterceptor.java
deleted file mode 100644
index d3a24d281..000000000
--- 
a/core/src/test/java/org/apache/struts2/dispatcher/ServletDispatchedTestAssertInterceptor.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.struts2.dispatcher;
-
-import org.junit.Assert;
-
-import org.apache.struts2.TestAction;
-
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.interceptor.Interceptor;
-
-
-/**
- */
-public class ServletDispatchedTestAssertInterceptor implements Interceptor {
-
-    private static final long serialVersionUID = 1980347231443329805L;
-
-    public ServletDispatchedTestAssertInterceptor() {
-        super();
-    }
-
-    public void destroy() {
-    }
-
-    public void init() {
-    }
-
-    public String intercept(ActionInvocation invocation) throws Exception {
-        Assert.assertTrue(invocation.getAction() instanceof TestAction);
-
-        TestAction testAction = (TestAction) invocation.getAction();
-
-        Assert.assertEquals("bar", testAction.getFoo());
-
-        String result = invocation.invoke();
-
-        return result;
-    }
-}

Reply via email to