incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1234453 [20/33] - in /incubator/isis/trunk/framework/core: commons/src/main/java/org/apache/isis/core/commons/authentication/ commons/src/main/java/org/apache/isis/core/commons/components/ commons/src/main/java/org/apache/isis/core/commons...
Date Sun, 22 Jan 2012 06:59:23 GMT
Modified: incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/actions/ActionMethodsFacetFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/actions/ActionMethodsFacetFactoryTest.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/actions/ActionMethodsFacetFactoryTest.java (original)
+++ incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/actions/ActionMethodsFacetFactoryTest.java Sun Jan 22 06:58:43 2012
@@ -17,9 +17,8 @@
  *  under the License.
  */
 
+package org.apache.isis.core.progmodel.facets.actions;
 
-package org.apache.isis.core.progmodel.facets.actions;
-
 import java.lang.reflect.Method;
 import java.util.Collections;
 import java.util.List;
@@ -75,291 +74,299 @@ import org.apache.isis.core.progmodel.fa
 import org.apache.isis.core.progmodel.facets.param.choices.methodnum.ActionParameterChoicesFacetViaMethod;
 import org.apache.isis.core.progmodel.facets.param.defaults.methodnum.ActionParameterDefaultsFacetFactory;
 import org.apache.isis.core.progmodel.facets.param.defaults.methodnum.ActionParameterDefaultsFacetViaMethod;
-
-
-public class ActionMethodsFacetFactoryTest extends AbstractFacetFactoryTest {
-
-    
-    private final ObjectSpecification voidSpec = new TestProxySpecification("VOID");
-    private final ObjectSpecification stringSpec = new TestProxySpecification("java.lang.String");
-    private final ObjectSpecification customerSpec = new TestProxySpecification("Customer");
-
-    
-    public void testActionInvocationFacetIsInstalledAndMethodRemoved() {
-        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        class Customer {
-            @SuppressWarnings("unused")
-            public void someAction() {}
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(ActionInvocationFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof ActionInvocationFacetViaMethod);
-        final ActionInvocationFacetViaMethod actionInvocationFacetViaMethod = (ActionInvocationFacetViaMethod) facet;
-        assertEquals(actionMethod, actionInvocationFacetViaMethod.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(actionMethod));
-    }
-
-    public void testProvidesDefaultNameForActionButIgnoresAnyNamedAnnotation() {
-        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-        
-        class Customer {
-            @SuppressWarnings("unused")
-            @Named("Renamed an action with a named annotation")
-            public void anActionWithNamedAnnotation() {}
-        }
-        final Method method = findMethod(Customer.class, "anActionWithNamedAnnotation");
-
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(NamedFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof NamedFacet);
-        final NamedFacet namedFacet = (NamedFacet) facet;
-        assertEquals("An Action With Named Annotation", namedFacet.value());
-    }
-
-    public void testPicksUpDebugPrefixAndSetsNameAppropriatelyAlso() {
-        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-        
-        class Customer {
-            @SuppressWarnings("unused")
-            public void debugAnActionWithDebugPrefix() {}
-        }
-        final Method method = findMethod(Customer.class, "debugAnActionWithDebugPrefix");
-        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));
-
-        Facet facet = facetedMethod.getFacet(DebugFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof DebugFacet);
-
-        facet = facetedMethod.getFacet(NamedFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof NamedFacet);
-        final NamedFacet namedFacet = (NamedFacet) facet;
-        assertEquals("An Action With Debug Prefix", namedFacet.value());
-    }
-
-    public void testPicksUpExplorationPrefixAndSetsNameAppropriatelyAlso() {
-        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-        
-        class Customer {
-            @SuppressWarnings("unused")
-            public void explorationAnActionWithExplorationPrefix() {}
-        }
-        final Method method = findMethod(Customer.class, "explorationAnActionWithExplorationPrefix");
-        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));
-
-        Facet facet = facetedMethod.getFacet(ExplorationFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof ExplorationFacet);
-
-        facet = facetedMethod.getFacet(NamedFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof NamedFacet);
-        final NamedFacet namedFacet = (NamedFacet) facet;
-        assertEquals("An Action With Exploration Prefix", namedFacet.value());
-    }
-
-    public void testCannotHaveBothDebugAndThenExplorationPrefix() {
-        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-        
-        class Customer {
-            @SuppressWarnings("unused")
-            public void debugExplorationAnActionWithDebugAndExplorationPrefix() {}
-        }
-        final Method method = findMethod(Customer.class, "debugExplorationAnActionWithDebugAndExplorationPrefix");
-        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));
-
-        Facet facet = facetedMethod.getFacet(DebugFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof DebugFacet);
-
-        facet = facetedMethod.getFacet(ExplorationFacet.class);
-        assertNull(facet);
-    }
-
-    public void testCannotHaveBothExplorationAndThenDebugPrefix() {
-        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-        
-        class Customer {
-            @SuppressWarnings("unused")
-            public void explorationDebugAnActionWithExplorationAndDebugPrefix() {}
-        }
-        final Method method = findMethod(Customer.class, "explorationDebugAnActionWithExplorationAndDebugPrefix");
-        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));
-
-        Facet facet = facetedMethod.getFacet(ExplorationFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof ExplorationFacet);
-
-        facet = facetedMethod.getFacet(DebugFacet.class);
-        assertNull(facet);
-    }
-
-    public void testPicksUpLocalPrefixAndSetsNameAppropriatelyAlso() {
-        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        class Customer {
-            @SuppressWarnings("unused")
-            public void localAnActionWithLocalPrefix() {}
-        }
-        final Method method = findMethod(Customer.class, "localAnActionWithLocalPrefix");
-        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));
-
-        Facet facet = facetedMethod.getFacet(ExecutedFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof ExecutedFacet);
-        final ExecutedFacet executedFacet = (ExecutedFacet) facet;
-        assertEquals(ExecutedFacet.Where.LOCALLY, executedFacet.value());
-
-        facet = facetedMethod.getFacet(NamedFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof NamedFacet);
-        final NamedFacet namedFacet = (NamedFacet) facet;
-        assertEquals("An Action With Local Prefix", namedFacet.value());
-    }
-
-    public void testPicksUpRemotePrefixAndSetsNameAppropriatelyAlso() {
-        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        class Customer {
-            @SuppressWarnings("unused")
-            public void remoteAnActionWithRemotePrefix() {}
-        }
-        final Method method = findMethod(Customer.class, "remoteAnActionWithRemotePrefix");
-        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));
-
-        Facet facet = facetedMethod.getFacet(ExecutedFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof ExecutedFacet);
-        final ExecutedFacet executedFacet = (ExecutedFacet) facet;
-        assertEquals(ExecutedFacet.Where.REMOTELY, executedFacet.value());
-
-        facet = facetedMethod.getFacet(NamedFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof NamedFacet);
-        final NamedFacet namedFacet = (NamedFacet) facet;
-        assertEquals("An Action With Remote Prefix", namedFacet.value());
-    }
-
-    public void testInstallsValidateMethodNoArgsFacetAndRemovesMethod() {
-        ActionValidationFacetViaValidateMethodFacetFactory facetFactory = new ActionValidationFacetViaValidateMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        class Customer {
-            @SuppressWarnings("unused")
-            public void someAction() {}
-
-            @SuppressWarnings("unused")
-            public String validateSomeAction() {
-                return null;
-            }
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-        final Method validateMethod = findMethod(Customer.class, "validateSomeAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(ActionValidationFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof ActionValidationFacetViaMethod);
-        final ActionValidationFacetViaMethod actionValidationFacetViaMethod = (ActionValidationFacetViaMethod) facet;
-        assertEquals(validateMethod, actionValidationFacetViaMethod.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(validateMethod));
-    }
-
-    public void testInstallsValidateMethodSomeArgsFacetAndRemovesMethod() {
-        ActionValidationFacetViaValidateMethodFacetFactory facetFactory = new ActionValidationFacetViaValidateMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        class Customer {
-            @SuppressWarnings("unused")
-            public void someAction(final int x, final int y) {}
-
-            @SuppressWarnings("unused")
-            public String validateSomeAction(final int x, final int y) {
-                return null;
-            }
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction", new Class[] { int.class, int.class });
-        final Method validateMethod = findMethod(Customer.class, "validateSomeAction", new Class[] { int.class, int.class });
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(ActionValidationFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof ActionValidationFacetViaMethod);
-        final ActionValidationFacetViaMethod actionValidationFacetViaMethod = (ActionValidationFacetViaMethod) facet;
-        assertEquals(validateMethod, actionValidationFacetViaMethod.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(validateMethod));
-    }
-
-    public void testInstallsParameterDefaultsMethodNoArgsFacetAndRemovesMethod() {
-        ActionDefaultsFacetFactory facetFactory = new ActionDefaultsFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-        
-        class Customer {
-            @SuppressWarnings("unused")
-            public void someAction(final int x, final Long y) {}
-
-            @SuppressWarnings("unused")
-            public Object[] defaultSomeAction() {
-                return null;
-            }
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction", new Class[] { int.class, Long.class });
-        final Method defaultMethod = findMethod(Customer.class, "defaultSomeAction", new Class[] { });
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(ActionDefaultsFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof ActionDefaultsFacetViaMethod);
-        final ActionDefaultsFacetViaMethod actionDefaultFacetViaMethod = (ActionDefaultsFacetViaMethod) facet;
-        assertEquals(defaultMethod, actionDefaultFacetViaMethod.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(defaultMethod));
-    }
-
+
+public class ActionMethodsFacetFactoryTest extends AbstractFacetFactoryTest {
+
+    private final ObjectSpecification voidSpec = new TestProxySpecification("VOID");
+    private final ObjectSpecification stringSpec = new TestProxySpecification("java.lang.String");
+    private final ObjectSpecification customerSpec = new TestProxySpecification("Customer");
+
+    public void testActionInvocationFacetIsInstalledAndMethodRemoved() {
+        final ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        class Customer {
+            @SuppressWarnings("unused")
+            public void someAction() {
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(ActionInvocationFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof ActionInvocationFacetViaMethod);
+        final ActionInvocationFacetViaMethod actionInvocationFacetViaMethod = (ActionInvocationFacetViaMethod) facet;
+        assertEquals(actionMethod, actionInvocationFacetViaMethod.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(actionMethod));
+    }
+
+    public void testProvidesDefaultNameForActionButIgnoresAnyNamedAnnotation() {
+        final ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        class Customer {
+            @SuppressWarnings("unused")
+            @Named("Renamed an action with a named annotation")
+            public void anActionWithNamedAnnotation() {
+            }
+        }
+        final Method method = findMethod(Customer.class, "anActionWithNamedAnnotation");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(NamedFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof NamedFacet);
+        final NamedFacet namedFacet = (NamedFacet) facet;
+        assertEquals("An Action With Named Annotation", namedFacet.value());
+    }
+
+    public void testPicksUpDebugPrefixAndSetsNameAppropriatelyAlso() {
+        final ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        class Customer {
+            @SuppressWarnings("unused")
+            public void debugAnActionWithDebugPrefix() {
+            }
+        }
+        final Method method = findMethod(Customer.class, "debugAnActionWithDebugPrefix");
+        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));
+
+        Facet facet = facetedMethod.getFacet(DebugFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof DebugFacet);
+
+        facet = facetedMethod.getFacet(NamedFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof NamedFacet);
+        final NamedFacet namedFacet = (NamedFacet) facet;
+        assertEquals("An Action With Debug Prefix", namedFacet.value());
+    }
+
+    public void testPicksUpExplorationPrefixAndSetsNameAppropriatelyAlso() {
+        final ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        class Customer {
+            @SuppressWarnings("unused")
+            public void explorationAnActionWithExplorationPrefix() {
+            }
+        }
+        final Method method = findMethod(Customer.class, "explorationAnActionWithExplorationPrefix");
+        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));
+
+        Facet facet = facetedMethod.getFacet(ExplorationFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof ExplorationFacet);
+
+        facet = facetedMethod.getFacet(NamedFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof NamedFacet);
+        final NamedFacet namedFacet = (NamedFacet) facet;
+        assertEquals("An Action With Exploration Prefix", namedFacet.value());
+    }
+
+    public void testCannotHaveBothDebugAndThenExplorationPrefix() {
+        final ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        class Customer {
+            @SuppressWarnings("unused")
+            public void debugExplorationAnActionWithDebugAndExplorationPrefix() {
+            }
+        }
+        final Method method = findMethod(Customer.class, "debugExplorationAnActionWithDebugAndExplorationPrefix");
+        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));
+
+        Facet facet = facetedMethod.getFacet(DebugFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof DebugFacet);
+
+        facet = facetedMethod.getFacet(ExplorationFacet.class);
+        assertNull(facet);
+    }
+
+    public void testCannotHaveBothExplorationAndThenDebugPrefix() {
+        final ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        class Customer {
+            @SuppressWarnings("unused")
+            public void explorationDebugAnActionWithExplorationAndDebugPrefix() {
+            }
+        }
+        final Method method = findMethod(Customer.class, "explorationDebugAnActionWithExplorationAndDebugPrefix");
+        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));
+
+        Facet facet = facetedMethod.getFacet(ExplorationFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof ExplorationFacet);
+
+        facet = facetedMethod.getFacet(DebugFacet.class);
+        assertNull(facet);
+    }
+
+    public void testPicksUpLocalPrefixAndSetsNameAppropriatelyAlso() {
+        final ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        class Customer {
+            @SuppressWarnings("unused")
+            public void localAnActionWithLocalPrefix() {
+            }
+        }
+        final Method method = findMethod(Customer.class, "localAnActionWithLocalPrefix");
+        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));
+
+        Facet facet = facetedMethod.getFacet(ExecutedFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof ExecutedFacet);
+        final ExecutedFacet executedFacet = (ExecutedFacet) facet;
+        assertEquals(ExecutedFacet.Where.LOCALLY, executedFacet.value());
+
+        facet = facetedMethod.getFacet(NamedFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof NamedFacet);
+        final NamedFacet namedFacet = (NamedFacet) facet;
+        assertEquals("An Action With Local Prefix", namedFacet.value());
+    }
+
+    public void testPicksUpRemotePrefixAndSetsNameAppropriatelyAlso() {
+        final ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        class Customer {
+            @SuppressWarnings("unused")
+            public void remoteAnActionWithRemotePrefix() {
+            }
+        }
+        final Method method = findMethod(Customer.class, "remoteAnActionWithRemotePrefix");
+        facetFactory.process(new ProcessMethodContext(Customer.class, method, methodRemover, facetedMethod));
+
+        Facet facet = facetedMethod.getFacet(ExecutedFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof ExecutedFacet);
+        final ExecutedFacet executedFacet = (ExecutedFacet) facet;
+        assertEquals(ExecutedFacet.Where.REMOTELY, executedFacet.value());
+
+        facet = facetedMethod.getFacet(NamedFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof NamedFacet);
+        final NamedFacet namedFacet = (NamedFacet) facet;
+        assertEquals("An Action With Remote Prefix", namedFacet.value());
+    }
+
+    public void testInstallsValidateMethodNoArgsFacetAndRemovesMethod() {
+        final ActionValidationFacetViaValidateMethodFacetFactory facetFactory = new ActionValidationFacetViaValidateMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        class Customer {
+            @SuppressWarnings("unused")
+            public void someAction() {
+            }
+
+            @SuppressWarnings("unused")
+            public String validateSomeAction() {
+                return null;
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+        final Method validateMethod = findMethod(Customer.class, "validateSomeAction");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(ActionValidationFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof ActionValidationFacetViaMethod);
+        final ActionValidationFacetViaMethod actionValidationFacetViaMethod = (ActionValidationFacetViaMethod) facet;
+        assertEquals(validateMethod, actionValidationFacetViaMethod.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(validateMethod));
+    }
+
+    public void testInstallsValidateMethodSomeArgsFacetAndRemovesMethod() {
+        final ActionValidationFacetViaValidateMethodFacetFactory facetFactory = new ActionValidationFacetViaValidateMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        class Customer {
+            @SuppressWarnings("unused")
+            public void someAction(final int x, final int y) {
+            }
+
+            @SuppressWarnings("unused")
+            public String validateSomeAction(final int x, final int y) {
+                return null;
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction", new Class[] { int.class, int.class });
+        final Method validateMethod = findMethod(Customer.class, "validateSomeAction", new Class[] { int.class, int.class });
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(ActionValidationFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof ActionValidationFacetViaMethod);
+        final ActionValidationFacetViaMethod actionValidationFacetViaMethod = (ActionValidationFacetViaMethod) facet;
+        assertEquals(validateMethod, actionValidationFacetViaMethod.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(validateMethod));
+    }
+
+    public void testInstallsParameterDefaultsMethodNoArgsFacetAndRemovesMethod() {
+        final ActionDefaultsFacetFactory facetFactory = new ActionDefaultsFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        class Customer {
+            @SuppressWarnings("unused")
+            public void someAction(final int x, final Long y) {
+            }
+
+            @SuppressWarnings("unused")
+            public Object[] defaultSomeAction() {
+                return null;
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction", new Class[] { int.class, Long.class });
+        final Method defaultMethod = findMethod(Customer.class, "defaultSomeAction", new Class[] {});
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(ActionDefaultsFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof ActionDefaultsFacetViaMethod);
+        final ActionDefaultsFacetViaMethod actionDefaultFacetViaMethod = (ActionDefaultsFacetViaMethod) facet;
+        assertEquals(defaultMethod, actionDefaultFacetViaMethod.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(defaultMethod));
+    }
+
     public void testInstallsParameterDefaultsMethodSomeArgsIsIgnored() {
-        ActionDefaultsFacetFactory facetFactory = new ActionDefaultsFacetFactory();
+        final ActionDefaultsFacetFactory facetFactory = new ActionDefaultsFacetFactory();
         facetFactory.setSpecificationLookup(reflector);
         reflector.setLoadSpecificationStringReturn(voidSpec);
 
         class Customer {
             @SuppressWarnings("unused")
-            public void someAction(final int x, final Long y) {}
+            public void someAction(final int x, final Long y) {
+            }
 
             @SuppressWarnings("unused")
-            public Object[] defaultSomeAction( final int x, final Long y ) {
+            public Object[] defaultSomeAction(final int x, final Long y) {
                 return null;
             }
         }
@@ -371,42 +378,44 @@ public class ActionMethodsFacetFactoryTe
         assertNull(facet);
     }
 
-    public void testInstallsParameterChoicesMethodNoArgsFacetAndRemovesMethod() {
-        ActionChoicesFacetFactory facetFactory = new ActionChoicesFacetFactory();
+    public void testInstallsParameterChoicesMethodNoArgsFacetAndRemovesMethod() {
+        final ActionChoicesFacetFactory facetFactory = new ActionChoicesFacetFactory();
         facetFactory.setSpecificationLookup(reflector);
 
-        class Customer {
-            @SuppressWarnings("unused")
-            public void someAction(final int x, final Long y) {}
-
-            @SuppressWarnings("unused")
-            public Object[] choicesSomeAction() {
-                return null;
-            }
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction", new Class[] { int.class, Long.class });
-        final Method choicesMethod = findMethod(Customer.class, "choicesSomeAction", new Class[] {  });
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(ActionChoicesFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof ActionChoicesFacetViaMethod);
-        final ActionChoicesFacetViaMethod actionChoicesFacetViaMethod = (ActionChoicesFacetViaMethod) facet;
-        assertEquals(choicesMethod, actionChoicesFacetViaMethod.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(choicesMethod));
-    }
-
+        class Customer {
+            @SuppressWarnings("unused")
+            public void someAction(final int x, final Long y) {
+            }
+
+            @SuppressWarnings("unused")
+            public Object[] choicesSomeAction() {
+                return null;
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction", new Class[] { int.class, Long.class });
+        final Method choicesMethod = findMethod(Customer.class, "choicesSomeAction", new Class[] {});
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(ActionChoicesFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof ActionChoicesFacetViaMethod);
+        final ActionChoicesFacetViaMethod actionChoicesFacetViaMethod = (ActionChoicesFacetViaMethod) facet;
+        assertEquals(choicesMethod, actionChoicesFacetViaMethod.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(choicesMethod));
+    }
+
     public void testInstallsParameterChoicesMethodSomeArgsIsIgnored() {
-        ActionChoicesFacetFactory facetFactory = new ActionChoicesFacetFactory();
+        final ActionChoicesFacetFactory facetFactory = new ActionChoicesFacetFactory();
         facetFactory.setSpecificationLookup(reflector);
         reflector.setLoadSpecificationStringReturn(voidSpec);
 
         class Customer {
             @SuppressWarnings("unused")
-            public void someAction(final int x, final Long y) {}
+            public void someAction(final int x, final Long y) {
+            }
 
             @SuppressWarnings("unused")
             public Object[] choicesSomeAction(final int x, final Long y) {
@@ -421,525 +430,529 @@ public class ActionMethodsFacetFactoryTe
         assertNull(facet);
     }
 
-    public static class CustomerStatic {
-        public void someAction(final int x, final Long y) {}
-
-        public static String nameSomeAction() {
-            return "Another Name";
-        }
-
-        public static String descriptionSomeAction() {
-            return "Some old description";
-        }
-
-        public static boolean alwaysHideSomeAction() {
-            return true;
-        }
-
-        public static boolean protectSomeAction() {
-            return true;
-        }
-
-        public static boolean hideSomeAction(final UserMemento userMemento) {
-            return true;
-        }
-
-        public static String disableSomeAction(final UserMemento userMemento) {
-            return "disabled for this user";
-        }
-
-        public static void otherAction(final int x, final Long y) {}
-
-        public static boolean alwaysHideOtherAction() {
-            return false;
-        }
-
-        public static boolean protectOtherAction() {
-            return false;
-        }
-    }
-
-    public void testInstallsNamedFacetUsingNameMethodAndRemovesMethod() {
-        NamedFacetViaNameMethodFacetFactory facetFactory = new NamedFacetViaNameMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        final Method actionMethod = findMethod(CustomerStatic.class, "someAction", new Class[] { int.class, Long.class });
-        final Method nameMethod = findMethod(CustomerStatic.class, "nameSomeAction");
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(NamedFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof NamedFacetAbstract);
-        final NamedFacetAbstract namedFacetAbstract = (NamedFacetAbstract) facet;
-        assertEquals("Another Name", namedFacetAbstract.value());
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(nameMethod));
-    }
-
-    public void testInstallsDescribedAsFacetUsingDescriptionAndRemovesMethod() {
-        DescribedAsFacetViaDescriptionMethodFacetFactory facetFactory = new DescribedAsFacetViaDescriptionMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        final Method actionMethod = findMethod(CustomerStatic.class, "someAction", new Class[] { int.class, Long.class });
-        final Method descriptionMethod = findMethod(CustomerStatic.class, "descriptionSomeAction");
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(DescribedAsFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof DescribedAsFacetAbstract);
-        final DescribedAsFacetAbstract describedAsFacetAbstract = (DescribedAsFacetAbstract) facet;
-        assertEquals("Some old description", describedAsFacetAbstract.value());
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(descriptionMethod));
-    }
-
-    public void testInstallsHiddenFacetUsingAlwaysHideAndRemovesMethod() {
-        HiddenFacetViaAlwaysHideMethodFacetFactory facetFactory = new HiddenFacetViaAlwaysHideMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-
-        final Method actionMethod = findMethod(CustomerStatic.class, "someAction", new Class[] { int.class, Long.class });
-        final Method alwaysHideMethod = findMethod(CustomerStatic.class, "alwaysHideSomeAction", new Class[] { });
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(HiddenFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof HiddenFacetAbstract);
-        final HiddenFacetAbstract hiddenFacetAbstract = (HiddenFacetAbstract) facet;
-        assertEquals(When.ALWAYS, hiddenFacetAbstract.value());
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(alwaysHideMethod));
-    }
-
-    public void testInstallsHiddenFacetUsingAlwaysHideWhenNotAndRemovesMethod() {
-        HiddenFacetViaAlwaysHideMethodFacetFactory facetFactory = new HiddenFacetViaAlwaysHideMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        final Method actionMethod = findMethod(CustomerStatic.class, "otherAction", new Class[] { int.class, Long.class });
-        final Method alwaysHideMethod = findMethod(CustomerStatic.class, "alwaysHideOtherAction", new Class[] { });
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, actionMethod, methodRemover, facetedMethod));
-
-        assertNull(facetedMethod.getFacet(HiddenFacet.class));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(alwaysHideMethod));
-    }
-
-    public void testInstallsDisabledFacetUsingProtectAndRemovesMethod() {
-        DisabledFacetViaProtectMethodFacetFactory facetFactory = new DisabledFacetViaProtectMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        final Method actionMethod = findMethod(CustomerStatic.class, "someAction", new Class[] { int.class, Long.class });
-        final Method protectMethod = findMethod(CustomerStatic.class, "protectSomeAction", new Class[] { });
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof DisabledFacetAbstract);
-        final DisabledFacetAbstract disabledFacetAbstract = (DisabledFacetAbstract) facet;
-        assertEquals(When.ALWAYS, disabledFacetAbstract.value());
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(protectMethod));
-    }
-
-    public void testDoesNotInstallDisabledFacetUsingProtectWhenNotAndRemovesMethod() {
-        DisabledFacetViaProtectMethodFacetFactory facetFactory = new DisabledFacetViaProtectMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        final Method actionMethod = findMethod(CustomerStatic.class, "otherAction", new Class[] { int.class, Long.class });
-        final Method protectMethod = findMethod(CustomerStatic.class, "protectOtherAction", new Class[] { });
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, actionMethod, methodRemover, facetedMethod));
-
-        assertNull(facetedMethod.getFacet(DisabledFacet.class));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(protectMethod));
-    }
-
-    public void testInstallsHiddenForSessionFacetAndRemovesMethod() {
-        
-        HiddenFacetViaHideForSessionMethodFacetFactory facetFactory = new HiddenFacetViaHideForSessionMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-        
-        final Method actionMethod = findMethod(CustomerStatic.class, "someAction", new Class[] { int.class, Long.class });
-        final Method hideMethod = findMethod(CustomerStatic.class, "hideSomeAction", new Class[] { UserMemento.class });
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(HideForSessionFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof HideForSessionFacetViaMethod);
-        final HideForSessionFacetViaMethod hideForSessionFacetViaMethod = (HideForSessionFacetViaMethod) facet;
-        assertEquals(hideMethod, hideForSessionFacetViaMethod.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(hideMethod));
-    }
-
-    public void testInstallsDisabledForSessionFacetAndRemovesMethod() {
-        DisabledFacetViaDisableForSessionMethodFacetFactory facetFactory = new DisabledFacetViaDisableForSessionMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        final Method actionMethod = findMethod(CustomerStatic.class, "someAction", new Class[] { int.class, Long.class });
-        final Method disableMethod = findMethod(CustomerStatic.class, "disableSomeAction", new Class[] { UserMemento.class });
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(DisableForSessionFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof DisableForSessionFacetViaMethod);
-        final DisableForSessionFacetViaMethod disableForSessionFacetViaMethod = (DisableForSessionFacetViaMethod) facet;
-        assertEquals(disableMethod, disableForSessionFacetViaMethod.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(disableMethod));
-    }
-
-    public void testActionReturnTypeWhenVoid() {
-        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        class Customer {
-            @SuppressWarnings("unused")
-            public void someAction() {}
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(ActionInvocationFacet.class);
-        final ActionInvocationFacetViaMethod actionInvocationFacetViaMethod = (ActionInvocationFacetViaMethod) facet;
-        assertEquals(voidSpec, actionInvocationFacetViaMethod.getReturnType());
-    }
-
-    public void testActionReturnTypeWhenNotVoid() {
-        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
+    public static class CustomerStatic {
+        public void someAction(final int x, final Long y) {
+        }
+
+        public static String nameSomeAction() {
+            return "Another Name";
+        }
+
+        public static String descriptionSomeAction() {
+            return "Some old description";
+        }
+
+        public static boolean alwaysHideSomeAction() {
+            return true;
+        }
+
+        public static boolean protectSomeAction() {
+            return true;
+        }
+
+        public static boolean hideSomeAction(final UserMemento userMemento) {
+            return true;
+        }
+
+        public static String disableSomeAction(final UserMemento userMemento) {
+            return "disabled for this user";
+        }
+
+        public static void otherAction(final int x, final Long y) {
+        }
+
+        public static boolean alwaysHideOtherAction() {
+            return false;
+        }
+
+        public static boolean protectOtherAction() {
+            return false;
+        }
+    }
+
+    public void testInstallsNamedFacetUsingNameMethodAndRemovesMethod() {
+        final NamedFacetViaNameMethodFacetFactory facetFactory = new NamedFacetViaNameMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        final Method actionMethod = findMethod(CustomerStatic.class, "someAction", new Class[] { int.class, Long.class });
+        final Method nameMethod = findMethod(CustomerStatic.class, "nameSomeAction");
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(NamedFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof NamedFacetAbstract);
+        final NamedFacetAbstract namedFacetAbstract = (NamedFacetAbstract) facet;
+        assertEquals("Another Name", namedFacetAbstract.value());
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(nameMethod));
+    }
+
+    public void testInstallsDescribedAsFacetUsingDescriptionAndRemovesMethod() {
+        final DescribedAsFacetViaDescriptionMethodFacetFactory facetFactory = new DescribedAsFacetViaDescriptionMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        final Method actionMethod = findMethod(CustomerStatic.class, "someAction", new Class[] { int.class, Long.class });
+        final Method descriptionMethod = findMethod(CustomerStatic.class, "descriptionSomeAction");
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(DescribedAsFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof DescribedAsFacetAbstract);
+        final DescribedAsFacetAbstract describedAsFacetAbstract = (DescribedAsFacetAbstract) facet;
+        assertEquals("Some old description", describedAsFacetAbstract.value());
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(descriptionMethod));
+    }
+
+    public void testInstallsHiddenFacetUsingAlwaysHideAndRemovesMethod() {
+        final HiddenFacetViaAlwaysHideMethodFacetFactory facetFactory = new HiddenFacetViaAlwaysHideMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        final Method actionMethod = findMethod(CustomerStatic.class, "someAction", new Class[] { int.class, Long.class });
+        final Method alwaysHideMethod = findMethod(CustomerStatic.class, "alwaysHideSomeAction", new Class[] {});
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(HiddenFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof HiddenFacetAbstract);
+        final HiddenFacetAbstract hiddenFacetAbstract = (HiddenFacetAbstract) facet;
+        assertEquals(When.ALWAYS, hiddenFacetAbstract.value());
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(alwaysHideMethod));
+    }
+
+    public void testInstallsHiddenFacetUsingAlwaysHideWhenNotAndRemovesMethod() {
+        final HiddenFacetViaAlwaysHideMethodFacetFactory facetFactory = new HiddenFacetViaAlwaysHideMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        final Method actionMethod = findMethod(CustomerStatic.class, "otherAction", new Class[] { int.class, Long.class });
+        final Method alwaysHideMethod = findMethod(CustomerStatic.class, "alwaysHideOtherAction", new Class[] {});
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, actionMethod, methodRemover, facetedMethod));
+
+        assertNull(facetedMethod.getFacet(HiddenFacet.class));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(alwaysHideMethod));
+    }
+
+    public void testInstallsDisabledFacetUsingProtectAndRemovesMethod() {
+        final DisabledFacetViaProtectMethodFacetFactory facetFactory = new DisabledFacetViaProtectMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        final Method actionMethod = findMethod(CustomerStatic.class, "someAction", new Class[] { int.class, Long.class });
+        final Method protectMethod = findMethod(CustomerStatic.class, "protectSomeAction", new Class[] {});
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof DisabledFacetAbstract);
+        final DisabledFacetAbstract disabledFacetAbstract = (DisabledFacetAbstract) facet;
+        assertEquals(When.ALWAYS, disabledFacetAbstract.value());
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(protectMethod));
+    }
+
+    public void testDoesNotInstallDisabledFacetUsingProtectWhenNotAndRemovesMethod() {
+        final DisabledFacetViaProtectMethodFacetFactory facetFactory = new DisabledFacetViaProtectMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        final Method actionMethod = findMethod(CustomerStatic.class, "otherAction", new Class[] { int.class, Long.class });
+        final Method protectMethod = findMethod(CustomerStatic.class, "protectOtherAction", new Class[] {});
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, actionMethod, methodRemover, facetedMethod));
+
+        assertNull(facetedMethod.getFacet(DisabledFacet.class));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(protectMethod));
+    }
+
+    public void testInstallsHiddenForSessionFacetAndRemovesMethod() {
+
+        final HiddenFacetViaHideForSessionMethodFacetFactory facetFactory = new HiddenFacetViaHideForSessionMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        final Method actionMethod = findMethod(CustomerStatic.class, "someAction", new Class[] { int.class, Long.class });
+        final Method hideMethod = findMethod(CustomerStatic.class, "hideSomeAction", new Class[] { UserMemento.class });
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(HideForSessionFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof HideForSessionFacetViaMethod);
+        final HideForSessionFacetViaMethod hideForSessionFacetViaMethod = (HideForSessionFacetViaMethod) facet;
+        assertEquals(hideMethod, hideForSessionFacetViaMethod.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(hideMethod));
+    }
+
+    public void testInstallsDisabledForSessionFacetAndRemovesMethod() {
+        final DisabledFacetViaDisableForSessionMethodFacetFactory facetFactory = new DisabledFacetViaDisableForSessionMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        final Method actionMethod = findMethod(CustomerStatic.class, "someAction", new Class[] { int.class, Long.class });
+        final Method disableMethod = findMethod(CustomerStatic.class, "disableSomeAction", new Class[] { UserMemento.class });
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(DisableForSessionFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof DisableForSessionFacetViaMethod);
+        final DisableForSessionFacetViaMethod disableForSessionFacetViaMethod = (DisableForSessionFacetViaMethod) facet;
+        assertEquals(disableMethod, disableForSessionFacetViaMethod.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(disableMethod));
+    }
+
+    public void testActionReturnTypeWhenVoid() {
+        final ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        class Customer {
+            @SuppressWarnings("unused")
+            public void someAction() {
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(ActionInvocationFacet.class);
+        final ActionInvocationFacetViaMethod actionInvocationFacetViaMethod = (ActionInvocationFacetViaMethod) facet;
+        assertEquals(voidSpec, actionInvocationFacetViaMethod.getReturnType());
+    }
+
+    public void testActionReturnTypeWhenNotVoid() {
+        final ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
         facetFactory.setSpecificationLookup(reflector);
         reflector.setLoadSpecificationStringReturn(stringSpec);
-
-        class Customer {
-            @SuppressWarnings("unused")
-            public String someAction() {
-                return null;
-            }
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(ActionInvocationFacet.class);
-        final ActionInvocationFacetViaMethod actionInvocationFacetViaMethod = (ActionInvocationFacetViaMethod) facet;
-        assertEquals(stringSpec, actionInvocationFacetViaMethod.getReturnType());
-    }
-
-    public void testActionOnType() {
-        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
+
+        class Customer {
+            @SuppressWarnings("unused")
+            public String someAction() {
+                return null;
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(ActionInvocationFacet.class);
+        final ActionInvocationFacetViaMethod actionInvocationFacetViaMethod = (ActionInvocationFacetViaMethod) facet;
+        assertEquals(stringSpec, actionInvocationFacetViaMethod.getReturnType());
+    }
+
+    public void testActionOnType() {
+        final ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
         facetFactory.setSpecificationLookup(reflector);
         reflector.setLoadSpecificationStringReturn(customerSpec);
-
-        class Customer {
-            @SuppressWarnings("unused")
-            public String someAction() {
-                return null;
-            }
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(ActionInvocationFacet.class);
-        final ActionInvocationFacetViaMethod actionInvocationFacetViaMethod = (ActionInvocationFacetViaMethod) facet;
-        assertEquals(customerSpec, actionInvocationFacetViaMethod.getOnType());
-    }
-
+
+        class Customer {
+            @SuppressWarnings("unused")
+            public String someAction() {
+                return null;
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(ActionInvocationFacet.class);
+        final ActionInvocationFacetViaMethod actionInvocationFacetViaMethod = (ActionInvocationFacetViaMethod) facet;
+        assertEquals(customerSpec, actionInvocationFacetViaMethod.getOnType());
+    }
+
     public void testInstallsParameterDefaultsMethodAndRemovesMethod() {
-        ActionParameterDefaultsFacetFactory facetFactory = new ActionParameterDefaultsFacetFactory();
+        final ActionParameterDefaultsFacetFactory facetFactory = new ActionParameterDefaultsFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        class Customer {
+            @SuppressWarnings("unused")
+            public void someAction(final int x, final long y) {
+            }
+
+            @SuppressWarnings("unused")
+            public int default0SomeAction() {
+                return 0;
+            }
+
+            @SuppressWarnings("unused")
+            public long default1SomeAction() {
+                return 0;
+            }
+        }
+
+        final Method actionMethod = findMethod(Customer.class, "someAction", new Class[] { int.class, long.class });
+        final Method default0Method = findMethod(Customer.class, "default0SomeAction", new Class[] {});
+        final Method default1Method = findMethod(Customer.class, "default1SomeAction", new Class[] {});
+
+        final FacetedMethod facetHolderWithParms = FacetedMethod.createActionFacetedMethod(Customer.class, actionMethod);
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetHolderWithParms));
+
+        final Facet facet0 = facetHolderWithParms.getParameters().get(0).getFacet(ActionParameterDefaultsFacet.class);
+        assertNotNull(facet0);
+        assertTrue(facet0 instanceof ActionParameterDefaultsFacetViaMethod);
+        final ActionParameterDefaultsFacetViaMethod actionDefaultFacetViaMethod0 = (ActionParameterDefaultsFacetViaMethod) facet0;
+        assertEquals(default0Method, actionDefaultFacetViaMethod0.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(default0Method));
+
+        final Facet facet1 = facetHolderWithParms.getParameters().get(1).getFacet(ActionParameterDefaultsFacet.class);
+        assertNotNull(facet1);
+        assertTrue(facet1 instanceof ActionParameterDefaultsFacetViaMethod);
+        final ActionParameterDefaultsFacetViaMethod actionDefaultFacetViaMethod1 = (ActionParameterDefaultsFacetViaMethod) facet1;
+        assertEquals(default1Method, actionDefaultFacetViaMethod1.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(default1Method));
+
+    }
+
+    public void testInstallsParameterChoicesMethodAndRemovesMethod() {
+        final ActionParameterChoicesFacetFactory facetFactory = new ActionParameterChoicesFacetFactory();
         facetFactory.setSpecificationLookup(reflector);
         reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        class Customer {
-            @SuppressWarnings("unused")
-            public void someAction(final int x, final long y) {}
-
-            @SuppressWarnings("unused")
-            public int default0SomeAction() {
-                return 0;
-            }
-
-            @SuppressWarnings("unused")
-            public long default1SomeAction() {
-                return 0;
-            }
-        }
-
-        Method actionMethod = findMethod(Customer.class, "someAction", new Class[] { int.class, long.class });
-        Method default0Method = findMethod(Customer.class, "default0SomeAction", new Class[] {});
-        Method default1Method = findMethod(Customer.class, "default1SomeAction", new Class[] {});
-
-        FacetedMethod facetHolderWithParms = FacetedMethod.createActionFacetedMethod(Customer.class, actionMethod);
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetHolderWithParms));
-
-        final Facet facet0 = facetHolderWithParms.getParameters().get(0).getFacet(ActionParameterDefaultsFacet.class);
-        assertNotNull(facet0);
-        assertTrue(facet0 instanceof ActionParameterDefaultsFacetViaMethod);
-        final ActionParameterDefaultsFacetViaMethod actionDefaultFacetViaMethod0 = (ActionParameterDefaultsFacetViaMethod) facet0;
-        assertEquals(default0Method, actionDefaultFacetViaMethod0.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(default0Method));
-
-        final Facet facet1 = facetHolderWithParms.getParameters().get(1).getFacet(ActionParameterDefaultsFacet.class);
-        assertNotNull(facet1);
-        assertTrue(facet1 instanceof ActionParameterDefaultsFacetViaMethod);
-        final ActionParameterDefaultsFacetViaMethod actionDefaultFacetViaMethod1 = (ActionParameterDefaultsFacetViaMethod) facet1;
-        assertEquals(default1Method, actionDefaultFacetViaMethod1.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(default1Method));
-
-    }
-
-    public void testInstallsParameterChoicesMethodAndRemovesMethod() {
-        ActionParameterChoicesFacetFactory facetFactory = new ActionParameterChoicesFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        class Customer {
-            @SuppressWarnings("unused")
-			public void someAction(final int x, final long y) {}
-
-            @SuppressWarnings("unused")
-			public List<Integer> choices0SomeAction() {
-                return Collections.emptyList();
-            }
-
-            @SuppressWarnings("unused")
-			public List<Long> choices1SomeAction() {
-                return Collections.emptyList();
-            }
-        }
-
-        Method actionMethod = findMethod(Customer.class, "someAction", new Class[] { int.class, long.class });
-        Method choices0Method = findMethod(Customer.class, "choices0SomeAction", new Class[] {});
-        Method choices1Method = findMethod(Customer.class, "choices1SomeAction", new Class[] {});
-
-        FacetedMethod facetHolderWithParms = FacetedMethod.createActionFacetedMethod(Customer.class, actionMethod);
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetHolderWithParms));
-
-        final Facet facet0 = facetHolderWithParms.getParameters().get(0).getFacet(ActionParameterChoicesFacet.class);
-        assertNotNull(facet0);
-        assertTrue(facet0 instanceof ActionParameterChoicesFacetViaMethod);
-        final ActionParameterChoicesFacetViaMethod actionChoicesFacetViaMethod0 = (ActionParameterChoicesFacetViaMethod) facet0;
-        assertEquals(choices0Method, actionChoicesFacetViaMethod0.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(choices0Method));
-
-        final Facet facet1 = facetHolderWithParms.getParameters().get(1).getFacet(ActionParameterChoicesFacet.class);
-        assertNotNull(facet1);
-        assertTrue(facet1 instanceof ActionParameterChoicesFacetViaMethod);
-        final ActionParameterChoicesFacetViaMethod actionChoicesFacetViaMethod1 = (ActionParameterChoicesFacetViaMethod) facet1;
-        assertEquals(choices1Method, actionChoicesFacetViaMethod1.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(choices1Method));
-
-    }
-
-
-    public void testActionsPickedUpFromSuperclass() {
-        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        class Customer {
-            @SuppressWarnings("unused")
-            public void someAction(final int x, final long y) {}
-        }
-
-        class CustomerEx extends Customer {
-        }
-
-        Method actionMethod = findMethod(CustomerEx.class, "someAction", new Class[] { int.class, long.class });
-
-
-        FacetedMethod facetHolderWithParms = FacetedMethod.createActionFacetedMethod(CustomerEx.class, actionMethod);
-
-
-        facetFactory.process(new ProcessMethodContext(CustomerEx.class, actionMethod, methodRemover, facetHolderWithParms));
-
-        final Facet facet0 = facetHolderWithParms.getFacet(ActionInvocationFacet.class);
-        assertNotNull(facet0);
-    }
-
-    public void testActionsPickedUpFromSuperclassButHelpersFromSubClass() {
-        ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
+
+        class Customer {
+            @SuppressWarnings("unused")
+            public void someAction(final int x, final long y) {
+            }
+
+            @SuppressWarnings("unused")
+            public List<Integer> choices0SomeAction() {
+                return Collections.emptyList();
+            }
+
+            @SuppressWarnings("unused")
+            public List<Long> choices1SomeAction() {
+                return Collections.emptyList();
+            }
+        }
+
+        final Method actionMethod = findMethod(Customer.class, "someAction", new Class[] { int.class, long.class });
+        final Method choices0Method = findMethod(Customer.class, "choices0SomeAction", new Class[] {});
+        final Method choices1Method = findMethod(Customer.class, "choices1SomeAction", new Class[] {});
+
+        final FacetedMethod facetHolderWithParms = FacetedMethod.createActionFacetedMethod(Customer.class, actionMethod);
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetHolderWithParms));
+
+        final Facet facet0 = facetHolderWithParms.getParameters().get(0).getFacet(ActionParameterChoicesFacet.class);
+        assertNotNull(facet0);
+        assertTrue(facet0 instanceof ActionParameterChoicesFacetViaMethod);
+        final ActionParameterChoicesFacetViaMethod actionChoicesFacetViaMethod0 = (ActionParameterChoicesFacetViaMethod) facet0;
+        assertEquals(choices0Method, actionChoicesFacetViaMethod0.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(choices0Method));
+
+        final Facet facet1 = facetHolderWithParms.getParameters().get(1).getFacet(ActionParameterChoicesFacet.class);
+        assertNotNull(facet1);
+        assertTrue(facet1 instanceof ActionParameterChoicesFacetViaMethod);
+        final ActionParameterChoicesFacetViaMethod actionChoicesFacetViaMethod1 = (ActionParameterChoicesFacetViaMethod) facet1;
+        assertEquals(choices1Method, actionChoicesFacetViaMethod1.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(choices1Method));
+
+    }
+
+    public void testActionsPickedUpFromSuperclass() {
+        final ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
         facetFactory.setSpecificationLookup(reflector);
         reflector.setLoadSpecificationStringReturn(voidSpec);
 
-        ActionParameterChoicesFacetFactory facetFactoryForChoices = new ActionParameterChoicesFacetFactory();
+        class Customer {
+            @SuppressWarnings("unused")
+            public void someAction(final int x, final long y) {
+            }
+        }
+
+        class CustomerEx extends Customer {
+        }
+
+        final Method actionMethod = findMethod(CustomerEx.class, "someAction", new Class[] { int.class, long.class });
+
+        final FacetedMethod facetHolderWithParms = FacetedMethod.createActionFacetedMethod(CustomerEx.class, actionMethod);
+
+        facetFactory.process(new ProcessMethodContext(CustomerEx.class, actionMethod, methodRemover, facetHolderWithParms));
+
+        final Facet facet0 = facetHolderWithParms.getFacet(ActionInvocationFacet.class);
+        assertNotNull(facet0);
+    }
+
+    public void testActionsPickedUpFromSuperclassButHelpersFromSubClass() {
+        final ActionInvocationFacetFactory facetFactory = new ActionInvocationFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+        reflector.setLoadSpecificationStringReturn(voidSpec);
+
+        final ActionParameterChoicesFacetFactory facetFactoryForChoices = new ActionParameterChoicesFacetFactory();
         facetFactoryForChoices.setSpecificationLookup(reflector);
         reflector.setLoadSpecificationStringReturn(voidSpec);
 
-        DisabledFacetViaDisableMethodFacetFactory facetFactoryForDisable = new DisabledFacetViaDisableMethodFacetFactory();
+        final DisabledFacetViaDisableMethodFacetFactory facetFactoryForDisable = new DisabledFacetViaDisableMethodFacetFactory();
         facetFactoryForDisable.setSpecificationLookup(reflector);
         reflector.setLoadSpecificationStringReturn(voidSpec);
 
-        class Customer {
-            @SuppressWarnings("unused")
-            public void someAction(final int x, final long y) {}
-
-            @SuppressWarnings("unused")
-            public int[] choices0SomeAction() {
-                return new int[0];
-            }
-        }
-
-        class CustomerEx extends Customer {
-            @Override
-            public int[] choices0SomeAction() {
-                return new int[0];
-            }
-
-            @SuppressWarnings("unused")
-            public long[] choices1SomeAction() {
-                return new long[0];
-            }
-
-            @SuppressWarnings("unused")
-            public String disableSomeAction() {
-                return null;
-            }
-        }
-
-        Method actionMethod = findMethod(CustomerEx.class, "someAction", new Class[] { int.class, long.class });
-        Method choices0Method = findMethod(CustomerEx.class, "choices0SomeAction", new Class[] {});
-        Method choices1Method = findMethod(CustomerEx.class, "choices1SomeAction", new Class[] {});
-        Method disableMethod = findMethod(CustomerEx.class, "disableSomeAction", new Class[] {});
-
-        FacetedMethod facetHolderWithParms = FacetedMethod.createActionFacetedMethod(CustomerEx.class, actionMethod);
-
+        class Customer {
+            @SuppressWarnings("unused")
+            public void someAction(final int x, final long y) {
+            }
+
+            @SuppressWarnings("unused")
+            public int[] choices0SomeAction() {
+                return new int[0];
+            }
+        }
+
+        class CustomerEx extends Customer {
+            @Override
+            public int[] choices0SomeAction() {
+                return new int[0];
+            }
+
+            @SuppressWarnings("unused")
+            public long[] choices1SomeAction() {
+                return new long[0];
+            }
+
+            @SuppressWarnings("unused")
+            public String disableSomeAction() {
+                return null;
+            }
+        }
+
+        final Method actionMethod = findMethod(CustomerEx.class, "someAction", new Class[] { int.class, long.class });
+        final Method choices0Method = findMethod(CustomerEx.class, "choices0SomeAction", new Class[] {});
+        final Method choices1Method = findMethod(CustomerEx.class, "choices1SomeAction", new Class[] {});
+        final Method disableMethod = findMethod(CustomerEx.class, "disableSomeAction", new Class[] {});
+
+        final FacetedMethod facetHolderWithParms = FacetedMethod.createActionFacetedMethod(CustomerEx.class, actionMethod);
+
         final ProcessMethodContext processMethodContext = new ProcessMethodContext(CustomerEx.class, actionMethod, methodRemover, facetHolderWithParms);
         facetFactory.process(processMethodContext);
         facetFactoryForChoices.process(processMethodContext);
-        facetFactoryForDisable.process(processMethodContext);
-
-        final Facet facet0 = facetHolderWithParms.getFacet(ActionInvocationFacet.class);
-        assertNotNull(facet0);
-
-        final Facet facet1 = facetHolderWithParms.getParameters().get(0).getFacet(ActionParameterChoicesFacet.class);
-        assertNotNull(facet1);
-        assertTrue(facet1 instanceof ActionParameterChoicesFacetViaMethod);
-        final ActionParameterChoicesFacetViaMethod actionChoicesFacetViaMethod0 = (ActionParameterChoicesFacetViaMethod) facet1;
-        assertEquals(choices0Method, actionChoicesFacetViaMethod0.getMethods().get(0));
-
-        final Facet facet2 = facetHolderWithParms.getParameters().get(1).getFacet(ActionParameterChoicesFacet.class);
-        assertNotNull(facet2);
-        assertTrue(facet2 instanceof ActionParameterChoicesFacetViaMethod);
-        final ActionParameterChoicesFacetViaMethod actionChoicesFacetViaMethod1 = (ActionParameterChoicesFacetViaMethod) facet2;
-        assertEquals(choices1Method, actionChoicesFacetViaMethod1.getMethods().get(0));
-
-        final Facet facet3 = facetHolderWithParms.getFacet(DisableForContextFacet.class);
-        assertNotNull(facet3);
-        assertTrue(facet3 instanceof DisableForContextFacetViaMethod);
-        final DisableForContextFacetViaMethod disableFacetViaMethod = (DisableForContextFacetViaMethod) facet3;
-        assertEquals(disableMethod, disableFacetViaMethod.getMethods().get(0));
-
-    }
-
-
-    public void testBothChoicesMethodCausesException() {
+        facetFactoryForDisable.process(processMethodContext);
+
+        final Facet facet0 = facetHolderWithParms.getFacet(ActionInvocationFacet.class);
+        assertNotNull(facet0);
+
+        final Facet facet1 = facetHolderWithParms.getParameters().get(0).getFacet(ActionParameterChoicesFacet.class);
+        assertNotNull(facet1);
+        assertTrue(facet1 instanceof ActionParameterChoicesFacetViaMethod);
+        final ActionParameterChoicesFacetViaMethod actionChoicesFacetViaMethod0 = (ActionParameterChoicesFacetViaMethod) facet1;
+        assertEquals(choices0Method, actionChoicesFacetViaMethod0.getMethods().get(0));
+
+        final Facet facet2 = facetHolderWithParms.getParameters().get(1).getFacet(ActionParameterChoicesFacet.class);
+        assertNotNull(facet2);
+        assertTrue(facet2 instanceof ActionParameterChoicesFacetViaMethod);
+        final ActionParameterChoicesFacetViaMethod actionChoicesFacetViaMethod1 = (ActionParameterChoicesFacetViaMethod) facet2;
+        assertEquals(choices1Method, actionChoicesFacetViaMethod1.getMethods().get(0));
+
+        final Facet facet3 = facetHolderWithParms.getFacet(DisableForContextFacet.class);
+        assertNotNull(facet3);
+        assertTrue(facet3 instanceof DisableForContextFacetViaMethod);
+        final DisableForContextFacetViaMethod disableFacetViaMethod = (DisableForContextFacetViaMethod) facet3;
+        assertEquals(disableMethod, disableFacetViaMethod.getMethods().get(0));
 
-        ActionChoicesFacetFactory facetFactory = new ActionChoicesFacetFactory();
+    }
+
+    public void testBothChoicesMethodCausesException() {
+
+        final ActionChoicesFacetFactory facetFactory = new ActionChoicesFacetFactory();
         facetFactory.setSpecificationLookup(reflector);
         reflector.setLoadSpecificationStringReturn(voidSpec);
 
-        ActionParameterChoicesFacetFactory facetFactoryForParams = new ActionParameterChoicesFacetFactory();
+        final ActionParameterChoicesFacetFactory facetFactoryForParams = new ActionParameterChoicesFacetFactory();
         facetFactoryForParams.setSpecificationLookup(reflector);
         reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        class Customer {
-            @SuppressWarnings("unused")
-            public void someAction(final int x, final long y) {}
-
-            @SuppressWarnings("unused")
-            public int[] choices0SomeAction() {
-                return new int[0];
-            }
-
-            @SuppressWarnings("unused")
-            public long[] choices1SomeAction() {
-                return new long[0];
-            }
-
-            @SuppressWarnings("unused")
-            public Object[][] choicesSomeAction() {
-                return null;
-            }
-        }
-
-        Method actionMethod = findMethod(Customer.class, "someAction", new Class[] { int.class, long.class });
-        FacetedMethod facetHolderWithParms = FacetedMethod.createActionFacetedMethod(Customer.class, actionMethod);
-
+
+        class Customer {
+            @SuppressWarnings("unused")
+            public void someAction(final int x, final long y) {
+            }
+
+            @SuppressWarnings("unused")
+            public int[] choices0SomeAction() {
+                return new int[0];
+            }
+
+            @SuppressWarnings("unused")
+            public long[] choices1SomeAction() {
+                return new long[0];
+            }
+
+            @SuppressWarnings("unused")
+            public Object[][] choicesSomeAction() {
+                return null;
+            }
+        }
+
+        final Method actionMethod = findMethod(Customer.class, "someAction", new Class[] { int.class, long.class });
+        final FacetedMethod facetHolderWithParms = FacetedMethod.createActionFacetedMethod(Customer.class, actionMethod);
+
         final ProcessMethodContext processMethodContext = new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetHolderWithParms);
-        facetFactory.process(processMethodContext);
+        facetFactory.process(processMethodContext);
         try {
-            facetFactoryForParams.process(processMethodContext);
-            fail("exception expected");
-        } catch (org.apache.isis.core.metamodel.exceptions.MetaModelException expected) {
-            // ignore
-        }
-    }
-
-    public void testBothDefaultMethodCausesException() {
-        ActionDefaultsFacetFactory facetFactory = new ActionDefaultsFacetFactory();
+            facetFactoryForParams.process(processMethodContext);
+            fail("exception expected");
+        } catch (final org.apache.isis.core.metamodel.exceptions.MetaModelException expected) {
+            // ignore
+        }
+    }
+
+    public void testBothDefaultMethodCausesException() {
+        final ActionDefaultsFacetFactory facetFactory = new ActionDefaultsFacetFactory();
         facetFactory.setSpecificationLookup(reflector);
         reflector.setLoadSpecificationStringReturn(voidSpec);
-
-        ActionParameterDefaultsFacetFactory facetFactoryForParams = new ActionParameterDefaultsFacetFactory();
+
+        final ActionParameterDefaultsFacetFactory facetFactoryForParams = new ActionParameterDefaultsFacetFactory();
         facetFactoryForParams.setSpecificationLookup(reflector);
         reflector.setLoadSpecificationStringReturn(voidSpec);
 
         class Customer {
-            @SuppressWarnings("unused")
-            public void someAction(final int x, final long y) {}
+            @SuppressWarnings("unused")
+            public void someAction(final int x, final long y) {
+            }
+
+            @SuppressWarnings("unused")
+            public int default0SomeAction() {
+                return 0;
+            }
+
+            @SuppressWarnings("unused")
+            public long default1SomeAction() {
+                return 0;
+            }
+
+            @SuppressWarnings("unused")
+            public Object[] defaultSomeAction() {
+                return null;
+            }
+        }
+
+        final Method actionMethod = findMethod(Customer.class, "someAction", new Class[] { int.class, long.class });
+        final FacetedMethod facetHolderWithParms = FacetedMethod.createActionFacetedMethod(Customer.class, actionMethod);
 
-            @SuppressWarnings("unused")
-            public int default0SomeAction() {
-                return 0;
-            }
-
-            @SuppressWarnings("unused")
-            public long default1SomeAction() {
-                return 0;
-            }
-
-            @SuppressWarnings("unused")
-            public Object[] defaultSomeAction() {
-                return null;
-            }
-        }
-
-        Method actionMethod = findMethod(Customer.class, "someAction", new Class[] { int.class, long.class });
-        FacetedMethod facetHolderWithParms = FacetedMethod.createActionFacetedMethod(Customer.class, actionMethod);
-
         final ProcessMethodContext processMethodContext = new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetHolderWithParms);
-        facetFactory.process(processMethodContext);
-        try {
+        facetFactory.process(processMethodContext);
+        try {
             facetFactoryForParams.process(processMethodContext);
-            fail("exception expected");
-        } catch (org.apache.isis.core.metamodel.exceptions.MetaModelException expected) {
-
-        }
+            fail("exception expected");
+        } catch (final org.apache.isis.core.metamodel.exceptions.MetaModelException expected) {
+
+        }
     }
 
-}
-
+}

Modified: incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/actions/IteratorFilteringFacetFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/actions/IteratorFilteringFacetFactoryTest.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/actions/IteratorFilteringFacetFactoryTest.java (original)
+++ incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/actions/IteratorFilteringFacetFactoryTest.java Sun Jan 22 06:58:43 2012
@@ -17,70 +17,70 @@
  *  under the License.
  */
 
+package org.apache.isis.core.progmodel.facets.actions;
 
-package org.apache.isis.core.progmodel.facets.actions;
-
 import java.lang.reflect.Method;
 import java.util.Iterator;
 
 import org.apache.isis.core.metamodel.facets.FacetFactory.ProcessClassContext;
 import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
 import org.apache.isis.core.progmodel.facets.object.ignore.javalang.IteratorFilteringFacetFactory;
-
-
-public class IteratorFilteringFacetFactoryTest extends AbstractFacetFactoryTest {
-
-    private IteratorFilteringFacetFactory facetFactory;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        facetFactory = new IteratorFilteringFacetFactory();
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        facetFactory = null;
-        super.tearDown();
-    }
-
-
-    public void testRequestsRemoverToRemoveIteratorMethods() {
-        class Customer {
+
+public class IteratorFilteringFacetFactoryTest extends AbstractFacetFactoryTest {
+
+    private IteratorFilteringFacetFactory facetFactory;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        facetFactory = new IteratorFilteringFacetFactory();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        facetFactory = null;
+        super.tearDown();
+    }
+
+    public void testRequestsRemoverToRemoveIteratorMethods() {
+        class Customer {
             @SuppressWarnings("unused")
-            public void someAction() {}
-        }
-        facetFactory.process(new ProcessClassContext(Customer.class, methodRemover, facetedMethod));
-
-        assertEquals(1, methodRemover.getRemoveMethodArgsCalls().size());
-    }
-
-    public void testNoIteratorMethodFiltered() {
-        class Customer {
-            public void someAction() {}
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        assertFalse(facetFactory.recognizes(actionMethod));
-    }
-
-    /**
-     * Not tested; this facet factory is needed, I think, but only filters out stuff when generics are in use.
-     */
-    public void xxxtestIterableIteratorMethodFiltered() {
-        class Customer implements Iterable {
-            public void someAction() {}
-
+            public void someAction() {
+            }
+        }
+        facetFactory.process(new ProcessClassContext(Customer.class, methodRemover, facetedMethod));
+
+        assertEquals(1, methodRemover.getRemoveMethodArgsCalls().size());
+    }
+
+    public void testNoIteratorMethodFiltered() {
+        class Customer {
+            public void someAction() {
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+
+        assertFalse(facetFactory.recognizes(actionMethod));
+    }
+
+    /**
+     * Not tested; this facet factory is needed, I think, but only filters out
+     * stuff when generics are in use.
+     */
+    public void xxxtestIterableIteratorMethodFiltered() {
+        class Customer implements Iterable {
+            public void someAction() {
+            }
+
             @Override
-            public Iterator iterator() {
-                return null;
-            }
-        }
-        final Method iteratorMethod = findMethod(Customer.class, "iterator");
-
-        assertTrue(facetFactory.recognizes(iteratorMethod));
-    }
-
-}
-
+            public Iterator iterator() {
+                return null;
+            }
+        }
+        final Method iteratorMethod = findMethod(Customer.class, "iterator");
+
+        assertTrue(facetFactory.recognizes(iteratorMethod));
+    }
+
+}



Mime
View raw message