Commits

Anonymous committed f7dfae4

Refactored some of the mock implementations to the core xwork sources to allow easy reuse within external applications
Issue number:
Obtained from:
Submitted by:
Reviewed by:

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

Comments (0)

Files changed (15)

src/java/com/opensymphony/xwork/mock/MockActionProxy.java

+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+
+package com.opensymphony.xwork.mock;
+
+import com.opensymphony.xwork.config.entities.ActionConfig;
+import com.opensymphony.xwork.ActionProxy;
+import com.opensymphony.xwork.ActionInvocation;
+
+/**
+ * @author Patrick Lightbody (plightbo at gmail dot com)
+ */
+public class MockActionProxy implements ActionProxy {
+    Object action;
+    String actionName;
+    ActionConfig config;
+    boolean executeResult;
+    ActionInvocation invocation;
+    String namespace;
+    String method;
+    boolean executedCalled;
+    String returnedResult;
+
+    public String execute() throws Exception {
+        executedCalled = true;
+
+        return returnedResult;
+    }
+
+    public void setReturnedResult(String returnedResult) {
+        this.returnedResult = returnedResult;
+    }
+
+    public boolean isExecutedCalled() {
+        return executedCalled;
+    }
+
+    public Object getAction() {
+        return action;
+    }
+
+    public void setAction(Object action) {
+        this.action = action;
+    }
+
+    public String getActionName() {
+        return actionName;
+    }
+
+    public void setActionName(String actionName) {
+        this.actionName = actionName;
+    }
+
+    public ActionConfig getConfig() {
+        return config;
+    }
+
+    public void setConfig(ActionConfig config) {
+        this.config = config;
+    }
+
+    public boolean getExecuteResult() {
+        return executeResult;
+    }
+
+    public void setExecuteResult(boolean executeResult) {
+        this.executeResult = executeResult;
+    }
+
+    public ActionInvocation getInvocation() {
+        return invocation;
+    }
+
+    public void setInvocation(ActionInvocation invocation) {
+        this.invocation = invocation;
+    }
+
+    public String getNamespace() {
+        return namespace;
+    }
+
+    public void setNamespace(String namespace) {
+        this.namespace = namespace;
+    }
+
+    public String getMethod() {
+        return method;
+    }
+
+    public void setMethod(String method) {
+        this.method = method;
+    }
+}

src/java/com/opensymphony/xwork/mock/MockInterceptor.java

+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.xwork.mock;
+
+import com.opensymphony.xwork.interceptor.Interceptor;
+import com.opensymphony.xwork.ActionInvocation;
+import junit.framework.Assert;
+
+
+/**
+ * MockInterceptor
+ *
+ * @author Jason Carreira
+ *         Created Apr 21, 2003 9:04:06 PM
+ */
+public class MockInterceptor 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() {
+    }
+
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+
+        if (!(o instanceof MockInterceptor)) {
+            return false;
+        }
+
+        final MockInterceptor testInterceptor = (MockInterceptor) o;
+
+        if (executed != testInterceptor.executed) {
+            return false;
+        }
+
+        if ((expectedFoo != null) ? (!expectedFoo.equals(testInterceptor.expectedFoo)) : (testInterceptor.expectedFoo != null))
+        {
+            return false;
+        }
+
+        if ((foo != null) ? (!foo.equals(testInterceptor.foo)) : (testInterceptor.foo != null)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    public int hashCode() {
+        int result;
+        result = ((expectedFoo != null) ? expectedFoo.hashCode() : 0);
+        result = (29 * result) + ((foo != null) ? foo.hashCode() : 0);
+        result = (29 * result) + (executed ? 1 : 0);
+
+        return result;
+    }
+
+    /**
+     * 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();
+    }
+}

src/java/com/opensymphony/xwork/mock/MockObjectTypeDeterminer.java

+/*
+ * Created on Dec 12, 2005
+ *
+ */
+package com.opensymphony.xwork.mock;
+
+import com.opensymphony.xwork.util.ObjectTypeDeterminer;
+
+/**
+ * @author Gabe
+ *
+ * Mocks the function of an ObjectTypeDeterminer for testing purposes
+ */
+public class MockObjectTypeDeterminer implements ObjectTypeDeterminer {
+
+    private Class keyClass;
+    private Class elementClass;
+    private String keyProperty;
+    private boolean shouldCreateIfNew;
+
+    public MockObjectTypeDeterminer() {}
+
+
+    /**
+     * @param keyClass
+     * @param elementClass
+     * @param keyProperty
+     * @param shouldCreateIfNew
+     */
+    public MockObjectTypeDeterminer(Class keyClass, Class elementClass,
+                                    String keyProperty, boolean shouldCreateIfNew) {
+        super();
+        this.keyClass = keyClass;
+        this.elementClass = elementClass;
+        this.keyProperty = keyProperty;
+        this.shouldCreateIfNew = shouldCreateIfNew;
+    }
+
+    /* (non-Javadoc)
+    * @see com.opensymphony.xwork.util.ObjectTypeDeterminer#getKeyClass(java.lang.Class, java.lang.String)
+    */
+    public Class getKeyClass(Class parentClass, String property) {
+
+        return getKeyClass();
+    }
+
+    /* (non-Javadoc)
+     * @see com.opensymphony.xwork.util.ObjectTypeDeterminer#getElementClass(java.lang.Class, java.lang.String, java.lang.Object)
+     */
+    public Class getElementClass(Class parentClass, String property, Object key) {
+
+        return getElementClass();
+    }
+
+    /* (non-Javadoc)
+     * @see com.opensymphony.xwork.util.ObjectTypeDeterminer#getKeyProperty(java.lang.Class, java.lang.String)
+     */
+    public String getKeyProperty(Class parentClass, String property) {
+
+        return getKeyProperty();
+    }
+
+    /* (non-Javadoc)
+     * @see com.opensymphony.xwork.util.ObjectTypeDeterminer#shouldCreateIfNew(java.lang.Class, java.lang.String, java.lang.Object, java.lang.String, boolean)
+     */
+    public boolean shouldCreateIfNew(Class parentClass, String property,
+                                     Object target, String keyProperty, boolean isIndexAccessed) {
+
+        return isShouldCreateIfNew();
+    }
+
+    /**
+     * @return Returns the elementClass.
+     */
+    public Class getElementClass() {
+        return elementClass;
+    }
+    /**
+     * @param elementClass The elementClass to set.
+     */
+    public void setElementClass(Class elementClass) {
+        this.elementClass = elementClass;
+    }
+    /**
+     * @return Returns the keyClass.
+     */
+    public Class getKeyClass() {
+        return keyClass;
+    }
+    /**
+     * @param keyClass The keyClass to set.
+     */
+    public void setKeyClass(Class keyClass) {
+        this.keyClass = keyClass;
+    }
+    /**
+     * @return Returns the keyProperty.
+     */
+    public String getKeyProperty() {
+        return keyProperty;
+    }
+    /**
+     * @param keyProperty The keyProperty to set.
+     */
+    public void setKeyProperty(String keyProperty) {
+        this.keyProperty = keyProperty;
+    }
+    /**
+     * @return Returns the shouldCreateIfNew.
+     */
+    public boolean isShouldCreateIfNew() {
+        return shouldCreateIfNew;
+    }
+    /**
+     * @param shouldCreateIfNew The shouldCreateIfNew to set.
+     */
+    public void setShouldCreateIfNew(boolean shouldCreateIfNew) {
+        this.shouldCreateIfNew = shouldCreateIfNew;
+    }
+}

src/test/com/opensymphony/xwork/MockActionProxy.java

-package com.opensymphony.xwork;
-
-import com.opensymphony.xwork.config.entities.ActionConfig;
-
-/**
- * @author Patrick Lightbody (plightbo at gmail dot com)
- */
-public class MockActionProxy implements ActionProxy {
-    Object action;
-    String actionName;
-    ActionConfig config;
-    boolean executeResult;
-    ActionInvocation invocation;
-    String namespace;
-    String method;
-    boolean executedCalled;
-    String returnedResult;
-
-    public String execute() throws Exception {
-        executedCalled = true;
-
-        return returnedResult;
-    }
-
-    public void setReturnedResult(String returnedResult) {
-        this.returnedResult = returnedResult;
-    }
-
-    public boolean isExecutedCalled() {
-        return executedCalled;
-    }
-
-    public Object getAction() {
-        return action;
-    }
-
-    public void setAction(Object action) {
-        this.action = action;
-    }
-
-    public String getActionName() {
-        return actionName;
-    }
-
-    public void setActionName(String actionName) {
-        this.actionName = actionName;
-    }
-
-    public ActionConfig getConfig() {
-        return config;
-    }
-
-    public void setConfig(ActionConfig config) {
-        this.config = config;
-    }
-
-    public boolean getExecuteResult() {
-        return executeResult;
-    }
-
-    public void setExecuteResult(boolean executeResult) {
-        this.executeResult = executeResult;
-    }
-
-    public ActionInvocation getInvocation() {
-        return invocation;
-    }
-
-    public void setInvocation(ActionInvocation invocation) {
-        this.invocation = invocation;
-    }
-
-    public String getNamespace() {
-        return namespace;
-    }
-
-    public void setNamespace(String namespace) {
-        this.namespace = namespace;
-    }
-
-    public String getMethod() {
-        return method;
-    }
-
-    public void setMethod(String method) {
-        this.method = method;
-    }
-}

src/test/com/opensymphony/xwork/MockInterceptor.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork;
-
-import com.opensymphony.xwork.interceptor.Interceptor;
-import junit.framework.Assert;
-
-
-/**
- * MockInterceptor
- *
- * @author Jason Carreira
- *         Created Apr 21, 2003 9:04:06 PM
- */
-public class MockInterceptor 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() {
-    }
-
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-
-        if (!(o instanceof MockInterceptor)) {
-            return false;
-        }
-
-        final MockInterceptor testInterceptor = (MockInterceptor) o;
-
-        if (executed != testInterceptor.executed) {
-            return false;
-        }
-
-        if ((expectedFoo != null) ? (!expectedFoo.equals(testInterceptor.expectedFoo)) : (testInterceptor.expectedFoo != null))
-        {
-            return false;
-        }
-
-        if ((foo != null) ? (!foo.equals(testInterceptor.foo)) : (testInterceptor.foo != null)) {
-            return false;
-        }
-
-        return true;
-    }
-
-    public int hashCode() {
-        int result;
-        result = ((expectedFoo != null) ? expectedFoo.hashCode() : 0);
-        result = (29 * result) + ((foo != null) ? foo.hashCode() : 0);
-        result = (29 * result) + (executed ? 1 : 0);
-
-        return result;
-    }
-
-    /**
-     * 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();
-    }
-}

src/test/com/opensymphony/xwork/config/ConfigurationTest.java

 package com.opensymphony.xwork.config;
 
 import com.opensymphony.xwork.*;
+import com.opensymphony.xwork.mock.MockInterceptor;
 import com.opensymphony.xwork.config.providers.MockConfigurationProvider;
 import com.opensymphony.xwork.config.providers.XmlConfigurationProvider;
-import junit.framework.TestCase;
 
 import java.util.HashMap;
 

src/test/com/opensymphony/xwork/config/providers/XmlConfigurationProviderActionsTest.java

  */
 package com.opensymphony.xwork.config.providers;
 
-import com.opensymphony.xwork.MockInterceptor;
+import com.opensymphony.xwork.mock.MockInterceptor;
 import com.opensymphony.xwork.ObjectFactory;
 import com.opensymphony.xwork.SimpleAction;
 import com.opensymphony.xwork.config.ConfigurationProvider;

src/test/com/opensymphony/xwork/config/providers/XmlConfigurationProviderInterceptorsTest.java

  */
 package com.opensymphony.xwork.config.providers;
 
-import com.opensymphony.xwork.MockInterceptor;
+import com.opensymphony.xwork.mock.MockInterceptor;
 import com.opensymphony.xwork.ObjectFactory;
 import com.opensymphony.xwork.SimpleAction;
 import com.opensymphony.xwork.config.ConfigurationException;

src/test/com/opensymphony/xwork/config/providers/xwork-test-actions.xml

         <interceptors>
             <interceptor name="timer" class="com.opensymphony.xwork.interceptor.TimerInterceptor"/>
             <interceptor name="logging" class="com.opensymphony.xwork.interceptor.LoggingInterceptor"/>
-            <interceptor name="test" class="com.opensymphony.xwork.MockInterceptor">
+            <interceptor name="test" class="com.opensymphony.xwork.mock.MockInterceptor">
                 <param name="foo">fooDefault</param>
             </interceptor>
 

src/test/com/opensymphony/xwork/config/providers/xwork-test-interceptors-basic.xml

         <interceptors>
             <interceptor name="timer" class="com.opensymphony.xwork.interceptor.TimerInterceptor"/>
             <interceptor name="logging" class="com.opensymphony.xwork.interceptor.LoggingInterceptor"/>
-            <interceptor name="test" class="com.opensymphony.xwork.MockInterceptor">
+            <interceptor name="test" class="com.opensymphony.xwork.mock.MockInterceptor">
                 <param name="foo">expectedFoo</param>
             </interceptor>
 

src/test/com/opensymphony/xwork/interceptor/AliasInterceptorTest.java

 package com.opensymphony.xwork.interceptor;
 
 import com.opensymphony.xwork.*;
+import com.opensymphony.xwork.mock.MockActionProxy;
 import com.opensymphony.xwork.config.entities.ActionConfig;
 
 import java.util.HashMap;

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

 
 import com.mockobjects.dynamic.Mock;
 import com.opensymphony.xwork.*;
+import com.opensymphony.xwork.mock.MockActionProxy;
 import junit.framework.TestCase;
 
 

src/test/com/opensymphony/xwork/util/MockObjectTypeDeterminer.java

-/*
- * Created on Dec 12, 2005
- *
- */
-package com.opensymphony.xwork.util;
-
-/**
- * @author Gabe
- *
- * Mocks the function of an ObjectTypeDeterminer for testing purposes
- */
-public class MockObjectTypeDeterminer implements ObjectTypeDeterminer {
-
-    private Class keyClass;
-    private Class elementClass;
-    private String keyProperty;
-    private boolean shouldCreateIfNew;
-    
-    public MockObjectTypeDeterminer() {}
-    
-    
-    /**
-     * @param keyClass
-     * @param elementClass
-     * @param keyProperty
-     * @param shouldCreateIfNew
-     */
-    public MockObjectTypeDeterminer(Class keyClass, Class elementClass,
-            String keyProperty, boolean shouldCreateIfNew) {
-        super();
-        this.keyClass = keyClass;
-        this.elementClass = elementClass;
-        this.keyProperty = keyProperty;
-        this.shouldCreateIfNew = shouldCreateIfNew;
-    }
-    
-    /* (non-Javadoc)
-     * @see com.opensymphony.xwork.util.ObjectTypeDeterminer#getKeyClass(java.lang.Class, java.lang.String)
-     */
-    public Class getKeyClass(Class parentClass, String property) {
-        
-        return getKeyClass();
-    }
-
-    /* (non-Javadoc)
-     * @see com.opensymphony.xwork.util.ObjectTypeDeterminer#getElementClass(java.lang.Class, java.lang.String, java.lang.Object)
-     */
-    public Class getElementClass(Class parentClass, String property, Object key) {
-        
-        return getElementClass();
-    }
-
-    /* (non-Javadoc)
-     * @see com.opensymphony.xwork.util.ObjectTypeDeterminer#getKeyProperty(java.lang.Class, java.lang.String)
-     */
-    public String getKeyProperty(Class parentClass, String property) {
-        
-        return getKeyProperty();
-    }
-
-    /* (non-Javadoc)
-     * @see com.opensymphony.xwork.util.ObjectTypeDeterminer#shouldCreateIfNew(java.lang.Class, java.lang.String, java.lang.Object, java.lang.String, boolean)
-     */
-    public boolean shouldCreateIfNew(Class parentClass, String property,
-            Object target, String keyProperty, boolean isIndexAccessed) {
-        
-        return isShouldCreateIfNew();
-    }
-
-    /**
-     * @return Returns the elementClass.
-     */
-    public Class getElementClass() {
-        return elementClass;
-    }
-    /**
-     * @param elementClass The elementClass to set.
-     */
-    public void setElementClass(Class elementClass) {
-        this.elementClass = elementClass;
-    }
-    /**
-     * @return Returns the keyClass.
-     */
-    public Class getKeyClass() {
-        return keyClass;
-    }
-    /**
-     * @param keyClass The keyClass to set.
-     */
-    public void setKeyClass(Class keyClass) {
-        this.keyClass = keyClass;
-    }
-    /**
-     * @return Returns the keyProperty.
-     */
-    public String getKeyProperty() {
-        return keyProperty;
-    }
-    /**
-     * @param keyProperty The keyProperty to set.
-     */
-    public void setKeyProperty(String keyProperty) {
-        this.keyProperty = keyProperty;
-    }
-    /**
-     * @return Returns the shouldCreateIfNew.
-     */
-    public boolean isShouldCreateIfNew() {
-        return shouldCreateIfNew;
-    }
-    /**
-     * @param shouldCreateIfNew The shouldCreateIfNew to set.
-     */
-    public void setShouldCreateIfNew(boolean shouldCreateIfNew) {
-        this.shouldCreateIfNew = shouldCreateIfNew;
-    }
-}

src/test/com/opensymphony/xwork/util/SetPropertiesTest.java

 
 import java.util.*;
 
+import com.opensymphony.xwork.mock.MockObjectTypeDeterminer;
+
 
 /**
  * @author CameronBraid and Gabe
     public void testAddingToListsWithObjects() {
         doTestAddingToListsWithObjects(true);
         doTestAddingToListsWithObjects(false);
-        
+
     }
     public void doTestAddingToListsWithObjects(boolean allowAdditions) {
-        
+
         MockObjectTypeDeterminer determiner
         =new MockObjectTypeDeterminer(null,Cat.class,null,allowAdditions);
         XWorkConverter.getInstance().setObjectTypeDeterminer(determiner);
-        
+
         Foo foo = new Foo();
         foo.setMoreCats(new ArrayList());
         String spielname = "Spielen";
         Object setCat = null;
         if (allowAdditions) {
              setCat = foo.getMoreCats().get(2);
-        
-        
-	        assertNotNull(setCat);
-	        assertTrue(setCat instanceof Cat);
-	        assertTrue(((Cat) setCat).getName().equals(spielname));
+
+
+            assertNotNull(setCat);
+            assertTrue(setCat instanceof Cat);
+            assertTrue(((Cat) setCat).getName().equals(spielname));
         }	else {
             assertTrue(foo.getMoreCats()==null || foo.getMoreCats().size()==0);
         }
-        
+
         //now try to set a lower number
         //to test setting after a higher one
         //has been created
         if (allowAdditions) {
-	        spielname = "paws";
-	        vs.setValue("moreCats[0].name", spielname);
-	        setCat = foo.getMoreCats().get(0);
-	        assertNotNull(setCat);
-	        assertTrue(setCat instanceof Cat);
-	        assertTrue(((Cat) setCat).getName().equals(spielname));
+            spielname = "paws";
+            vs.setValue("moreCats[0].name", spielname);
+            setCat = foo.getMoreCats().get(0);
+            assertNotNull(setCat);
+            assertTrue(setCat instanceof Cat);
+            assertTrue(((Cat) setCat).getName().equals(spielname));
         }
 
     }
-    
+
     public void testAddingToMapsWithObjects() {
         doTestAddingToMapsWithObjects(true);
         doTestAddingToMapsWithObjects(false);
-        
+
     }
-    
+
     public void doTestAddingToMapsWithObjects(boolean allowAdditions) {
-        
+
         MockObjectTypeDeterminer determiner
         =new MockObjectTypeDeterminer(Long.class,Cat.class,null,allowAdditions);
         XWorkConverter.getInstance().setObjectTypeDeterminer(determiner);
-        
+
         Foo foo = new Foo();
         foo.setAnotherCatMap(new HashMap());
         String spielname = "Spielen";
         vs.setValue("anotherCatMap[\"3\"].name", spielname);
         Object setCat = foo.getAnotherCatMap().get(new Long(3));
         if (allowAdditions) {
-	        assertNotNull(setCat);
-	        assertTrue(setCat instanceof Cat);
-	        assertTrue(((Cat) setCat).getName().equals(spielname));
+            assertNotNull(setCat);
+            assertTrue(setCat instanceof Cat);
+            assertTrue(((Cat) setCat).getName().equals(spielname));
         }	else {
             assertNull(setCat);
         }
 
     }
 
-    
+
     public void testAddingAndModifyingCollectionWithObjects() {
         doTestAddingAndModifyingCollectionWithObjects(new HashSet());
-        doTestAddingAndModifyingCollectionWithObjects(new ArrayList());      
-        
+        doTestAddingAndModifyingCollectionWithObjects(new ArrayList());
+
     }
     public void doTestAddingAndModifyingCollectionWithObjects(Collection barColl) {
 
         XWorkConverter.getInstance().setObjectTypeDeterminer(new DefaultObjectTypeDeterminer());
         OgnlValueStack vs = new OgnlValueStack();
         Foo foo = new Foo();
-        
+
         foo.setBarCollection(barColl);
         Bar bar1 = new Bar();
         bar1.setId(new Long(11));
         }
 
     }
-    
+
     public void testAddingToCollectionBasedOnPermission() {
-        
+
         MockObjectTypeDeterminer determiner
         =new MockObjectTypeDeterminer(Long.class,Bar.class,"id",true);
         XWorkConverter.getInstance().setObjectTypeDeterminer(determiner);
-        
+
         Collection barColl=new HashSet();
-        
+
         OgnlValueStack vs = new OgnlValueStack();
         OgnlContextState.setCreatingNullObjects(vs.getContext(), true);
         OgnlContextState.setReportingConversionErrors(vs.getContext(), true);
         Foo foo = new Foo();
-        
+
         foo.setBarCollection(barColl);
-        
+
         vs.push(foo);
-        
+
         String bar1Title="title";
         vs.setValue("barCollection(11).title", bar1Title);
-        
+
         assertEquals(1, barColl.size());
         Object bar=barColl.iterator().next();
         assertTrue(bar instanceof Bar);
         assertEquals(((Bar)bar).getTitle(), bar1Title);
         assertEquals(((Bar)bar).getId(), new Long(11));
-        
+
         //now test where there is no permission
         determiner.setShouldCreateIfNew(false);
-        
+
         String bar2Title="another title";
         vs.setValue("barCollection(22).title", bar1Title);
-        
+
         assertEquals(1, barColl.size());
         bar=barColl.iterator().next();
         assertTrue(bar instanceof Bar);
         assertEquals(((Bar)bar).getTitle(), bar1Title);
         assertEquals(((Bar)bar).getId(), new Long(11));
-        
-        
+
+
     }
 
 

src/test/xwork-default.xml

             <interceptor name="component" class="com.opensymphony.xwork.interceptor.component.ComponentInterceptor"/>
             <interceptor name="validation" class="com.opensymphony.xwork.validator.ValidationInterceptor"/>
 			<interceptor name="alias" class="com.opensymphony.xwork.interceptor.AliasInterceptor"/>
-            <interceptor name="test" class="com.opensymphony.xwork.MockInterceptor">
+            <interceptor name="test" class="com.opensymphony.xwork.mock.MockInterceptor">
                 <param name="foo">expectedFoo</param>
             </interceptor>
             <interceptor name="reference-resolver" class="com.opensymphony.xwork.interceptor.ExternalReferencesInterceptor"/>