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 [22/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/collections/CollectionFieldMethodsFacetFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/collections/CollectionFieldMethodsFacetFactoryTest.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/collections/CollectionFieldMethodsFacetFactoryTest.java (original)
+++ incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/collections/CollectionFieldMethodsFacetFactoryTest.java Sun Jan 22 06:58:43 2012
@@ -17,9 +17,8 @@
  *  under the License.
  */
 
+package org.apache.isis.core.progmodel.facets.collections;
 
-package org.apache.isis.core.progmodel.facets.collections;
-
 import java.lang.reflect.Method;
 import java.util.Collection;
 import java.util.List;
@@ -69,680 +68,697 @@ import org.apache.isis.core.progmodel.fa
 import org.apache.isis.core.progmodel.facets.members.hide.staticmethod.HiddenFacetViaAlwaysHideMethodFacetFactory;
 import org.apache.isis.core.progmodel.facets.members.named.staticmethod.NamedFacetViaMethod;
 import org.apache.isis.core.progmodel.facets.members.named.staticmethod.NamedFacetViaNameMethodFacetFactory;
-
-
-public class CollectionFieldMethodsFacetFactoryTest extends AbstractFacetFactoryTest {
-
 
-    public void testPropertyAccessorFacetIsInstalledForJavaUtilCollectionAndMethodRemoved() {
-        CollectionAccessorFacetFactory facetFactory = new CollectionAccessorFacetFactory();
+public class CollectionFieldMethodsFacetFactoryTest extends AbstractFacetFactoryTest {
+
+    public void testPropertyAccessorFacetIsInstalledForJavaUtilCollectionAndMethodRemoved() {
+        final CollectionAccessorFacetFactory facetFactory = new CollectionAccessorFacetFactory();
         facetFactory.setSpecificationLookup(reflector);
-        
-        class Customer {
+
+        class Customer {
             @SuppressWarnings({ "rawtypes", "unused" })
-            public Collection getOrders() {
-                return null;
-            }
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(PropertyOrCollectionAccessorFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof CollectionAccessorFacetViaAccessor);
-        final CollectionAccessorFacetViaAccessor propertyAccessorFacetViaAccessor = (CollectionAccessorFacetViaAccessor) facet;
-        assertEquals(collectionAccessorMethod, propertyAccessorFacetViaAccessor.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(collectionAccessorMethod));
-    }
-
-    public void testPropertyAccessorFacetIsInstalledForJavaUtilListAndMethodRemoved() {
-        CollectionAccessorFacetFactory facetFactory = new CollectionAccessorFacetFactory();
+            public Collection getOrders() {
+                return null;
+            }
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(PropertyOrCollectionAccessorFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof CollectionAccessorFacetViaAccessor);
+        final CollectionAccessorFacetViaAccessor propertyAccessorFacetViaAccessor = (CollectionAccessorFacetViaAccessor) facet;
+        assertEquals(collectionAccessorMethod, propertyAccessorFacetViaAccessor.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(collectionAccessorMethod));
+    }
+
+    public void testPropertyAccessorFacetIsInstalledForJavaUtilListAndMethodRemoved() {
+        final CollectionAccessorFacetFactory facetFactory = new CollectionAccessorFacetFactory();
         facetFactory.setSpecificationLookup(reflector);
 
-        class Customer {
+        class Customer {
             @SuppressWarnings({ "rawtypes", "unused" })
-            public List getOrders() {
-                return null;
-            }
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(PropertyOrCollectionAccessorFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof CollectionAccessorFacetViaAccessor);
-        final CollectionAccessorFacetViaAccessor propertyAccessorFacetViaAccessor = (CollectionAccessorFacetViaAccessor) facet;
-        assertEquals(collectionAccessorMethod, propertyAccessorFacetViaAccessor.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(collectionAccessorMethod));
-    }
-
+            public List getOrders() {
+                return null;
+            }
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(PropertyOrCollectionAccessorFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof CollectionAccessorFacetViaAccessor);
+        final CollectionAccessorFacetViaAccessor propertyAccessorFacetViaAccessor = (CollectionAccessorFacetViaAccessor) facet;
+        assertEquals(collectionAccessorMethod, propertyAccessorFacetViaAccessor.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(collectionAccessorMethod));
+    }
+
     public void testPropertyAccessorFacetIsInstalledForJavaUtilSetAndMethodRemoved() {
-        CollectionAccessorFacetFactory facetFactory = new CollectionAccessorFacetFactory();
+        final CollectionAccessorFacetFactory facetFactory = new CollectionAccessorFacetFactory();
         facetFactory.setSpecificationLookup(reflector);
-
-        class Customer {
+
+        class Customer {
             @SuppressWarnings({ "rawtypes", "unused" })
-            public Set getOrders() {
-                return null;
-            }
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(PropertyOrCollectionAccessorFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof CollectionAccessorFacetViaAccessor);
-        final CollectionAccessorFacetViaAccessor propertyAccessorFacetViaAccessor = (CollectionAccessorFacetViaAccessor) facet;
-        assertEquals(collectionAccessorMethod, propertyAccessorFacetViaAccessor.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(collectionAccessorMethod));
-    }
-
+            public Set getOrders() {
+                return null;
+            }
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(PropertyOrCollectionAccessorFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof CollectionAccessorFacetViaAccessor);
+        final CollectionAccessorFacetViaAccessor propertyAccessorFacetViaAccessor = (CollectionAccessorFacetViaAccessor) facet;
+        assertEquals(collectionAccessorMethod, propertyAccessorFacetViaAccessor.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(collectionAccessorMethod));
+    }
+
     public void testPropertyAccessorFacetIsInstalledForObjectArrayAndMethodRemoved() {
-        CollectionAccessorFacetFactory facetFactory = new CollectionAccessorFacetFactory();
+        final CollectionAccessorFacetFactory facetFactory = new CollectionAccessorFacetFactory();
         facetFactory.setSpecificationLookup(reflector);
-
-        class Customer {
+
+        class Customer {
             @SuppressWarnings("unused")
-            public Object[] getOrders() {
-                return null;
-            }
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(PropertyOrCollectionAccessorFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof CollectionAccessorFacetViaAccessor);
-        final CollectionAccessorFacetViaAccessor propertyAccessorFacetViaAccessor = (CollectionAccessorFacetViaAccessor) facet;
-        assertEquals(collectionAccessorMethod, propertyAccessorFacetViaAccessor.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(collectionAccessorMethod));
-    }
-
+            public Object[] getOrders() {
+                return null;
+            }
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(PropertyOrCollectionAccessorFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof CollectionAccessorFacetViaAccessor);
+        final CollectionAccessorFacetViaAccessor propertyAccessorFacetViaAccessor = (CollectionAccessorFacetViaAccessor) facet;
+        assertEquals(collectionAccessorMethod, propertyAccessorFacetViaAccessor.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(collectionAccessorMethod));
+    }
+
     public void testPropertyAccessorFacetIsInstalledForOrderArrayAndMethodRemoved() {
-        CollectionAccessorFacetFactory facetFactory = new CollectionAccessorFacetFactory();
+        final CollectionAccessorFacetFactory facetFactory = new CollectionAccessorFacetFactory();
         facetFactory.setSpecificationLookup(reflector);
-
-        @SuppressWarnings("hiding")
-        class Order {}
-        class Customer {
-            @SuppressWarnings("unused")
-            public Order[] getOrders() {
-                return null;
-            }
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(PropertyOrCollectionAccessorFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof CollectionAccessorFacetViaAccessor);
-        final CollectionAccessorFacetViaAccessor propertyAccessorFacetViaAccessor = (CollectionAccessorFacetViaAccessor) facet;
-        assertEquals(collectionAccessorMethod, propertyAccessorFacetViaAccessor.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(collectionAccessorMethod));
-    }
-
+
+        @SuppressWarnings("hiding")
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            public Order[] getOrders() {
+                return null;
+            }
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(PropertyOrCollectionAccessorFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof CollectionAccessorFacetViaAccessor);
+        final CollectionAccessorFacetViaAccessor propertyAccessorFacetViaAccessor = (CollectionAccessorFacetViaAccessor) facet;
+        assertEquals(collectionAccessorMethod, propertyAccessorFacetViaAccessor.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(collectionAccessorMethod));
+    }
+
     public void testAddToFacetIsInstalledViaAccessorIfNoExplicitAddToMethodExists() {
-        CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
+        final CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        @SuppressWarnings("hiding")
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            public Collection<Order> getOrders() {
+                return null;
+            }
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(CollectionAddToFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof CollectionAddToFacetViaAccessor);
+        final CollectionAddToFacetViaAccessor collectionAddToFacetViaAccessor = (CollectionAddToFacetViaAccessor) facet;
+        assertEquals(collectionAccessorMethod, collectionAddToFacetViaAccessor.getMethods().get(0));
+    }
+
+    public void testCannotInferTypeOfFacetIfNoExplicitAddToOrRemoveFromMethods() {
+        final CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        @SuppressWarnings("hiding")
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            public Collection<Order> getOrders() {
+                return null;
+            }
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        assertNull(facetedMethod.getFacet(TypeOfFacet.class));
+    }
+
+    public void testRemoveFromFacetIsInstalledViaAccessorIfNoExplicitRemoveFromMethodExists() {
+        final CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        @SuppressWarnings("hiding")
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            public Collection<Order> getOrders() {
+                return null;
+            }
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(CollectionRemoveFromFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof CollectionRemoveFromFacetViaAccessor);
+        final CollectionRemoveFromFacetViaAccessor collectionRemoveFromFacetViaAccessor = (CollectionRemoveFromFacetViaAccessor) facet;
+        assertEquals(collectionAccessorMethod, collectionRemoveFromFacetViaAccessor.getMethods().get(0));
+    }
+
+    public void testAddToFacetIsInstalledAndMethodRemoved() {
+        final CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
         facetFactory.setSpecificationLookup(reflector);
-
-        @SuppressWarnings("hiding")
-        class Order {}
-        class Customer {
-            @SuppressWarnings("unused")
-            public Collection<Order> getOrders() {
-                return null;
-            }
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(CollectionAddToFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof CollectionAddToFacetViaAccessor);
-        final CollectionAddToFacetViaAccessor collectionAddToFacetViaAccessor = (CollectionAddToFacetViaAccessor) facet;
-        assertEquals(collectionAccessorMethod, collectionAddToFacetViaAccessor.getMethods().get(0));
-    }
-
-    public void testCannotInferTypeOfFacetIfNoExplicitAddToOrRemoveFromMethods() {
-        CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-
-        @SuppressWarnings("hiding")
-        class Order{}
-        class Customer {
-            @SuppressWarnings("unused")
-            public Collection<Order> getOrders() {
-                return null;
-            }
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        assertNull(facetedMethod.getFacet(TypeOfFacet.class));
-    }
-
-    public void testRemoveFromFacetIsInstalledViaAccessorIfNoExplicitRemoveFromMethodExists() {
-        CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-
-        @SuppressWarnings("hiding")
-        class Order{}
-        class Customer {
-            @SuppressWarnings("unused")
-            public Collection<Order> getOrders() {
-                return null;
-            }
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(CollectionRemoveFromFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof CollectionRemoveFromFacetViaAccessor);
-        final CollectionRemoveFromFacetViaAccessor collectionRemoveFromFacetViaAccessor = (CollectionRemoveFromFacetViaAccessor) facet;
-        assertEquals(collectionAccessorMethod, collectionRemoveFromFacetViaAccessor.getMethods().get(0));
-    }
-
-    public void testAddToFacetIsInstalledAndMethodRemoved() {
-        CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-
-        @SuppressWarnings("hiding")
-        class Order {}
-        class Customer {
-            @SuppressWarnings("unused")
-            public Collection<Order> getOrders() {
-                return null;
-            }
-
-            @SuppressWarnings("unused")
-            public void addToOrders(final Order o) {};
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-        final Method addToMethod = findMethod(Customer.class, "addToOrders", new Class[] { Order.class });
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(CollectionAddToFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof CollectionAddToFacetViaMethod);
-        final CollectionAddToFacetViaMethod collectionAddToFacetViaMethod = (CollectionAddToFacetViaMethod) facet;
-        assertEquals(addToMethod, collectionAddToFacetViaMethod.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(addToMethod));
-    }
-
-    public void testCanInferTypeOfFacetFromExplicitAddToMethod() {
-        CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-
-        @SuppressWarnings("hiding")
-        class Order {}
-        class Customer {
-            @SuppressWarnings("unused")
-            public Collection<Order> getOrders() {
-                return null;
-            }
-
-            @SuppressWarnings("unused")
-            public void addToOrders(final Order o) {};
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetInferredFromSupportingMethods);
-        final TypeOfFacetInferredFromSupportingMethods typeOfFacetInferredFromSupportingMethods = (TypeOfFacetInferredFromSupportingMethods) facet;
-        assertEquals(Order.class, typeOfFacetInferredFromSupportingMethods.value());
-    }
-
-    public void testRemoveFromFacetIsInstalledAndMethodRemoved() {
-        CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-
-        @SuppressWarnings("hiding")
-        class Order {}
-        class Customer {
+
+        @SuppressWarnings("hiding")
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            public Collection<Order> getOrders() {
+                return null;
+            }
+
+            @SuppressWarnings("unused")
+            public void addToOrders(final Order o) {
+            };
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+        final Method addToMethod = findMethod(Customer.class, "addToOrders", new Class[] { Order.class });
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(CollectionAddToFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof CollectionAddToFacetViaMethod);
+        final CollectionAddToFacetViaMethod collectionAddToFacetViaMethod = (CollectionAddToFacetViaMethod) facet;
+        assertEquals(addToMethod, collectionAddToFacetViaMethod.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(addToMethod));
+    }
+
+    public void testCanInferTypeOfFacetFromExplicitAddToMethod() {
+        final CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        @SuppressWarnings("hiding")
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            public Collection<Order> getOrders() {
+                return null;
+            }
+
+            @SuppressWarnings("unused")
+            public void addToOrders(final Order o) {
+            };
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetInferredFromSupportingMethods);
+        final TypeOfFacetInferredFromSupportingMethods typeOfFacetInferredFromSupportingMethods = (TypeOfFacetInferredFromSupportingMethods) facet;
+        assertEquals(Order.class, typeOfFacetInferredFromSupportingMethods.value());
+    }
+
+    public void testRemoveFromFacetIsInstalledAndMethodRemoved() {
+        final CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        @SuppressWarnings("hiding")
+        class Order {
+        }
+        class Customer {
             @SuppressWarnings({ "rawtypes", "unused" })
-            public Collection getOrders() {
-                return null;
-            }
-
-            @SuppressWarnings("unused")
-            public void removeFromOrders(final Order o) {};
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-        final Method removeFromMethod = findMethod(Customer.class, "removeFromOrders", new Class[] { Order.class });
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(CollectionRemoveFromFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof CollectionRemoveFromFacetViaMethod);
-        final CollectionRemoveFromFacetViaMethod collectionRemoveFromFacetViaMethod = (CollectionRemoveFromFacetViaMethod) facet;
-        assertEquals(removeFromMethod, collectionRemoveFromFacetViaMethod.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(removeFromMethod));
-    }
-
-    public void testCanInferTypeOfFacetFromExplicitRemoveFromMethod() {
-        CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-
-        @SuppressWarnings("hiding")
-        class Order {}
-        class Customer {
-            @SuppressWarnings("unused")
-            public Collection<Order> getOrders() {
-                return null;
-            };
-            @SuppressWarnings("unused")
-            public void removeFromOrders(final Order o) {};
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetInferredFromSupportingMethods);
-        final TypeOfFacetInferredFromSupportingMethods typeOfFacetInferredFromSupportingMethods = (TypeOfFacetInferredFromSupportingMethods) facet;
-        assertEquals(Order.class, typeOfFacetInferredFromSupportingMethods.value());
-    }
-
-    public void testClearFacetIsInstalledAndMethodRemoved() {
-        CollectionClearFacetFactory facetFactory = new CollectionClearFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-
-        @SuppressWarnings({ "hiding", "unused" })
-        class Order {}
-        class Customer {
+            public Collection getOrders() {
+                return null;
+            }
+
+            @SuppressWarnings("unused")
+            public void removeFromOrders(final Order o) {
+            };
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+        final Method removeFromMethod = findMethod(Customer.class, "removeFromOrders", new Class[] { Order.class });
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(CollectionRemoveFromFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof CollectionRemoveFromFacetViaMethod);
+        final CollectionRemoveFromFacetViaMethod collectionRemoveFromFacetViaMethod = (CollectionRemoveFromFacetViaMethod) facet;
+        assertEquals(removeFromMethod, collectionRemoveFromFacetViaMethod.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(removeFromMethod));
+    }
+
+    public void testCanInferTypeOfFacetFromExplicitRemoveFromMethod() {
+        final CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        @SuppressWarnings("hiding")
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            public Collection<Order> getOrders() {
+                return null;
+            };
+
+            @SuppressWarnings("unused")
+            public void removeFromOrders(final Order o) {
+            };
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetInferredFromSupportingMethods);
+        final TypeOfFacetInferredFromSupportingMethods typeOfFacetInferredFromSupportingMethods = (TypeOfFacetInferredFromSupportingMethods) facet;
+        assertEquals(Order.class, typeOfFacetInferredFromSupportingMethods.value());
+    }
+
+    public void testClearFacetIsInstalledAndMethodRemoved() {
+        final CollectionClearFacetFactory facetFactory = new CollectionClearFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        @SuppressWarnings({ "hiding", "unused" })
+        class Order {
+        }
+        class Customer {
             @SuppressWarnings({ "rawtypes", "unused" })
-            public Collection getOrders() {
-                return null;
-            }
-
-            @SuppressWarnings("unused")
-            public void clearOrders() {};
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-        final Method clearMethod = findMethod(Customer.class, "clearOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(CollectionClearFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof CollectionClearFacetViaMethod);
-        final CollectionClearFacetViaMethod collectionClearFacetViaMethod = (CollectionClearFacetViaMethod) facet;
-        assertEquals(clearMethod, collectionClearFacetViaMethod.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(clearMethod));
-    }
-
-    public void testClearFacetIsInstalledViaAccessorIfNoExplicitClearMethod() {
-        CollectionClearFacetFactory facetFactory = new CollectionClearFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        
-        @SuppressWarnings({ "hiding", "unused" })
-        class Order {}
-        class Customer {
+            public Collection getOrders() {
+                return null;
+            }
+
+            @SuppressWarnings("unused")
+            public void clearOrders() {
+            };
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+        final Method clearMethod = findMethod(Customer.class, "clearOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(CollectionClearFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof CollectionClearFacetViaMethod);
+        final CollectionClearFacetViaMethod collectionClearFacetViaMethod = (CollectionClearFacetViaMethod) facet;
+        assertEquals(clearMethod, collectionClearFacetViaMethod.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(clearMethod));
+    }
+
+    public void testClearFacetIsInstalledViaAccessorIfNoExplicitClearMethod() {
+        final CollectionClearFacetFactory facetFactory = new CollectionClearFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        @SuppressWarnings({ "hiding", "unused" })
+        class Order {
+        }
+        class Customer {
             @SuppressWarnings({ "rawtypes", "unused" })
-            public Collection getOrders() {
-                return null;
-            }
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(CollectionClearFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof CollectionClearFacetViaAccessor);
-        final CollectionClearFacetViaAccessor collectionClearFacetViaAccessor = (CollectionClearFacetViaAccessor) facet;
-        assertEquals(collectionAccessorMethod, collectionClearFacetViaAccessor.getMethods().get(0));
-    }
-
+            public Collection getOrders() {
+                return null;
+            }
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(CollectionClearFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof CollectionClearFacetViaAccessor);
+        final CollectionClearFacetViaAccessor collectionClearFacetViaAccessor = (CollectionClearFacetViaAccessor) facet;
+        assertEquals(collectionAccessorMethod, collectionClearFacetViaAccessor.getMethods().get(0));
+    }
+
     public void testValidateAddToFacetIsInstalledAndMethodRemoved() {
-        CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
+        final CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
         facetFactory.setSpecificationLookup(reflector);
-        
-        @SuppressWarnings("hiding")
-        class Order {}
-        class Customer {
+
+        @SuppressWarnings("hiding")
+        class Order {
+        }
+        class Customer {
             @SuppressWarnings({ "rawtypes", "unused" })
-            public Collection getOrders() {
-                return null;
-            }
-
-            @SuppressWarnings("unused")
-            public void addToOrders(final Order o) {};
-
-            @SuppressWarnings("unused")
-            public String validateAddToOrders(final Order o) {
-                return null;
-            };
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-        final Method validateAddToMethod = findMethod(Customer.class, "validateAddToOrders", new Class[] { Order.class });
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(CollectionValidateAddToFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof CollectionValidateAddToFacetViaMethod);
-        final CollectionValidateAddToFacetViaMethod collectionValidateAddToFacetViaMethod = (CollectionValidateAddToFacetViaMethod) facet;
-        assertEquals(validateAddToMethod, collectionValidateAddToFacetViaMethod.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(validateAddToMethod));
-    }
-
-    public void testValidateRemoveFromFacetIsInstalledAndMethodRemoved() {
-        CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-
-        @SuppressWarnings("hiding")
-        class Order {}
-        class Customer {
-            @SuppressWarnings("unused")
-            public Collection<Order> getOrders() {
-                return null;
-            }
-
-            @SuppressWarnings("unused")
-            public void removeFromOrders(final Order o) {};
-
-            @SuppressWarnings("unused")
-            public String validateRemoveFromOrders(final Order o) {
-                return null;
-            };
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-        final Method validateRemoveFromMethod = findMethod(Customer.class, "validateRemoveFromOrders",
-                new Class[] { Order.class });
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(CollectionValidateRemoveFromFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof CollectionValidateRemoveFromFacetViaMethod);
-        final CollectionValidateRemoveFromFacetViaMethod collectionValidateRemoveFromFacetViaMethod = (CollectionValidateRemoveFromFacetViaMethod) facet;
-        assertEquals(validateRemoveFromMethod, collectionValidateRemoveFromFacetViaMethod.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(validateRemoveFromMethod));
-    }
-
-    public void testMethodFoundInSuperclass() {
-        CollectionAccessorFacetFactory facetFactory = new CollectionAccessorFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-
-        @SuppressWarnings("hiding")
-        class Order {}
-        class Customer {
-            @SuppressWarnings("unused")
-            public Collection<Order> getOrders() {
-                return null;
-            }
-        }
-
-        class CustomerEx extends Customer {
-        }
-
-
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(CustomerEx.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(PropertyOrCollectionAccessorFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof CollectionAccessorFacetViaAccessor);
-        final CollectionAccessorFacetViaAccessor collectionAccessorFacetViaMethod = (CollectionAccessorFacetViaAccessor) facet;
-        assertEquals(collectionAccessorMethod, collectionAccessorFacetViaMethod.getMethods().get(0));
-    }
-
-    public void testMethodFoundInSuperclassButHelpeMethodsFoundInSubclasses() {
-        CollectionAccessorFacetFactory facetFactoryForAccessor = new CollectionAccessorFacetFactory();
+            public Collection getOrders() {
+                return null;
+            }
+
+            @SuppressWarnings("unused")
+            public void addToOrders(final Order o) {
+            };
+
+            @SuppressWarnings("unused")
+            public String validateAddToOrders(final Order o) {
+                return null;
+            };
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+        final Method validateAddToMethod = findMethod(Customer.class, "validateAddToOrders", new Class[] { Order.class });
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(CollectionValidateAddToFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof CollectionValidateAddToFacetViaMethod);
+        final CollectionValidateAddToFacetViaMethod collectionValidateAddToFacetViaMethod = (CollectionValidateAddToFacetViaMethod) facet;
+        assertEquals(validateAddToMethod, collectionValidateAddToFacetViaMethod.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(validateAddToMethod));
+    }
+
+    public void testValidateRemoveFromFacetIsInstalledAndMethodRemoved() {
+        final CollectionAddRemoveAndValidateFacetFactory facetFactory = new CollectionAddRemoveAndValidateFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        @SuppressWarnings("hiding")
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            public Collection<Order> getOrders() {
+                return null;
+            }
+
+            @SuppressWarnings("unused")
+            public void removeFromOrders(final Order o) {
+            };
+
+            @SuppressWarnings("unused")
+            public String validateRemoveFromOrders(final Order o) {
+                return null;
+            };
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+        final Method validateRemoveFromMethod = findMethod(Customer.class, "validateRemoveFromOrders", new Class[] { Order.class });
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(CollectionValidateRemoveFromFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof CollectionValidateRemoveFromFacetViaMethod);
+        final CollectionValidateRemoveFromFacetViaMethod collectionValidateRemoveFromFacetViaMethod = (CollectionValidateRemoveFromFacetViaMethod) facet;
+        assertEquals(validateRemoveFromMethod, collectionValidateRemoveFromFacetViaMethod.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(validateRemoveFromMethod));
+    }
+
+    public void testMethodFoundInSuperclass() {
+        final CollectionAccessorFacetFactory facetFactory = new CollectionAccessorFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        @SuppressWarnings("hiding")
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            public Collection<Order> getOrders() {
+                return null;
+            }
+        }
+
+        class CustomerEx extends Customer {
+        }
+
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(CustomerEx.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(PropertyOrCollectionAccessorFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof CollectionAccessorFacetViaAccessor);
+        final CollectionAccessorFacetViaAccessor collectionAccessorFacetViaMethod = (CollectionAccessorFacetViaAccessor) facet;
+        assertEquals(collectionAccessorMethod, collectionAccessorFacetViaMethod.getMethods().get(0));
+    }
+
+    public void testMethodFoundInSuperclassButHelpeMethodsFoundInSubclasses() {
+        final CollectionAccessorFacetFactory facetFactoryForAccessor = new CollectionAccessorFacetFactory();
         facetFactoryForAccessor.setSpecificationLookup(reflector);
-        CollectionAddRemoveAndValidateFacetFactory facetFactoryForHelpers = new CollectionAddRemoveAndValidateFacetFactory();
+        final CollectionAddRemoveAndValidateFacetFactory facetFactoryForHelpers = new CollectionAddRemoveAndValidateFacetFactory();
         facetFactoryForHelpers.setSpecificationLookup(reflector);
 
-        @SuppressWarnings("hiding")
-        class Order {}
-        class Customer {
-            @SuppressWarnings("unused")
-            public Collection<Order> getOrders() {
-                return null;
-            }
-        }
-
-        class CustomerEx extends Customer {
-            @SuppressWarnings("unused")
-            public void removeFromOrders(final Order o) {};
-
-            @SuppressWarnings("unused")
-            public String validateRemoveFromOrders(final Order o) {
-                return null;
-            };
-        }
-
-
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-        final Method removeFromMethod = findMethod(CustomerEx.class, "removeFromOrders",
-                new Class[] { Order.class });
-        final Method validateRemoveFromMethod = findMethod(CustomerEx.class, "validateRemoveFromOrders",
-                new Class[] { Order.class });
-
+        @SuppressWarnings("hiding")
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            public Collection<Order> getOrders() {
+                return null;
+            }
+        }
+
+        class CustomerEx extends Customer {
+            @SuppressWarnings("unused")
+            public void removeFromOrders(final Order o) {
+            };
+
+            @SuppressWarnings("unused")
+            public String validateRemoveFromOrders(final Order o) {
+                return null;
+            };
+        }
+
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+        final Method removeFromMethod = findMethod(CustomerEx.class, "removeFromOrders", new Class[] { Order.class });
+        final Method validateRemoveFromMethod = findMethod(CustomerEx.class, "validateRemoveFromOrders", new Class[] { Order.class });
+
         facetFactoryForAccessor.process(new ProcessMethodContext(CustomerEx.class, collectionAccessorMethod, methodRemover, facetedMethod));
-        facetFactoryForHelpers.process(new ProcessMethodContext(CustomerEx.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(CollectionRemoveFromFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof CollectionRemoveFromFacetViaMethod);
-        final CollectionRemoveFromFacetViaMethod collectionRemoveFromFacetViaMethod = (CollectionRemoveFromFacetViaMethod) facet;
-        assertEquals(removeFromMethod, collectionRemoveFromFacetViaMethod.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(removeFromMethod));
-
-        final Facet facet1 = facetedMethod.getFacet(CollectionValidateRemoveFromFacet.class);
-        assertNotNull(facet1);
-        assertTrue(facet1 instanceof CollectionValidateRemoveFromFacetViaMethod);
-        final CollectionValidateRemoveFromFacetViaMethod collectionValidateRemoveFromFacetViaMethod = (CollectionValidateRemoveFromFacetViaMethod) facet1;
-        assertEquals(validateRemoveFromMethod, collectionValidateRemoveFromFacetViaMethod.getMethods().get(0));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(validateRemoveFromMethod));
-    }
-
-    static class Order {}
-
-    public static class CustomerStatic {
-        public Collection<Order> getOrders() {
-            return null;
-        }
-
-        public static String nameOrders() {
-            return "Most Recent Orders";
-        };
-
-        public static String descriptionOrders() {
-            return "Some old description";
-        }
-
-        public static boolean alwaysHideOrders() {
-            return true;
-        }
-
-        public static boolean protectOrders() {
-            return true;
-        }
-
-        public static boolean hideOrders(final UserMemento userMemento) {
-            return true;
-        }
-
-        public static String disableOrders(final UserMemento userMemento) {
-            return "disabled for this user";
-        }
-
-        public static void getOtherOrders() {}
-
-        public static boolean alwaysHideOtherOrders() {
-            return false;
-        }
-
-        public static boolean protectOtherOrders() {
-            return false;
-        }
-    }
-
-    public void testInstallsNamedFacetUsingNameMethodAndRemovesMethod() {
-        NamedFacetViaNameMethodFacetFactory facetFactory = new NamedFacetViaNameMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-
-        final Method collectionAccessorMethod = findMethod(CustomerStatic.class, "getOrders");
-        final Method nameMethod = findMethod(CustomerStatic.class, "nameOrders");
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(NamedFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof NamedFacetViaMethod);
-        final NamedFacetViaMethod namedFacet = (NamedFacetViaMethod) facet;
-        assertEquals("Most Recent Orders", namedFacet.value());
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(nameMethod));
-    }
-
-    public void testInstallsDescribedAsFacetUsingDescriptionAndRemovesMethod() {
-        DescribedAsFacetViaDescriptionMethodFacetFactory facetFactory = new DescribedAsFacetViaDescriptionMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        
-        final Method collectionAccessorMethod = findMethod(CustomerStatic.class, "getOrders");
-        final Method descriptionMethod = findMethod(CustomerStatic.class, "descriptionOrders");
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(DescribedAsFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof DescribedAsFacetViaMethod);
-        final DescribedAsFacetViaMethod describedAsFacet = (DescribedAsFacetViaMethod) facet;
-        assertEquals("Some old description", describedAsFacet.value());
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(descriptionMethod));
-    }
-
-    public void testInstallsHiddenFacetUsingAlwaysHideAndRemovesMethod() {
-        HiddenFacetViaAlwaysHideMethodFacetFactory facetFactory = new HiddenFacetViaAlwaysHideMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-
-        final Method collectionAccessorMethod = findMethod(CustomerStatic.class, "getOrders");
-        final Method alwaysHideMethod = findMethod(CustomerStatic.class, "alwaysHideOrders");
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(HiddenFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof HiddenFacetAlways);
-        final HiddenFacetAbstract hiddenFacetAlways = (HiddenFacetAlways) facet;
-        assertEquals(When.ALWAYS, hiddenFacetAlways.value());
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(alwaysHideMethod));
-    }
-
-    public void testInstallsHiddenFacetUsingAlwaysHideWhenNotAndRemovesMethod() {
-        HiddenFacetViaAlwaysHideMethodFacetFactory facetFactory = new HiddenFacetViaAlwaysHideMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-
-        final Method collectionAccessorMethod = findMethod(CustomerStatic.class, "getOtherOrders");
-        final Method alwaysHideMethod = findMethod(CustomerStatic.class, "alwaysHideOtherOrders");
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        assertNull(facetedMethod.getFacet(HiddenFacet.class));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(alwaysHideMethod));
-    }
-
-    public void testInstallsDisabledFacetUsingProtectAndRemovesMethod() {
-        DisabledFacetViaProtectMethodFacetFactory facetFactory = new DisabledFacetViaProtectMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-
-        final Method collectionAccessorMethod = findMethod(CustomerStatic.class, "getOrders");
-        final Method protectMethod = findMethod(CustomerStatic.class, "protectOrders");
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof DisabledFacetAlways);
-        final DisabledFacetAlways disabledFacetAlways = (DisabledFacetAlways) facet;
-        assertEquals(When.ALWAYS, disabledFacetAlways.value());
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(protectMethod));
-    }
-
-    public void testDoesNotInstallDisabledFacetUsingProtectWhenNotAndRemovesMethod() {
-        DisabledFacetViaProtectMethodFacetFactory facetFactory = new DisabledFacetViaProtectMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-
-        final Method collectionAccessorMethod = findMethod(CustomerStatic.class, "getOtherOrders");
-        final Method protectMethod = findMethod(CustomerStatic.class, "protectOtherOrders");
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        assertNull(facetedMethod.getFacet(DisabledFacet.class));
-
-        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(protectMethod));
-    }
-
-    public void testInstallsHiddenForSessionFacetAndRemovesMethod() {
-        HiddenFacetViaHideForSessionMethodFacetFactory facetFactory = new HiddenFacetViaHideForSessionMethodFacetFactory();
-        facetFactory.setSpecificationLookup(reflector);
-        
-        final Method collectionAccessorMethod = findMethod(CustomerStatic.class, "getOrders");
-        final Method hideMethod = findMethod(CustomerStatic.class, "hideOrders", new Class[] { UserMemento.class });
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, 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);
-
-        final Method collectionAccessorMethod = findMethod(CustomerStatic.class, "getOrders");
-        final Method disableMethod = findMethod(CustomerStatic.class, "disableOrders", new Class[] { UserMemento.class });
-
-        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, 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));
-    }
-
-}
-
+        facetFactoryForHelpers.process(new ProcessMethodContext(CustomerEx.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(CollectionRemoveFromFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof CollectionRemoveFromFacetViaMethod);
+        final CollectionRemoveFromFacetViaMethod collectionRemoveFromFacetViaMethod = (CollectionRemoveFromFacetViaMethod) facet;
+        assertEquals(removeFromMethod, collectionRemoveFromFacetViaMethod.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(removeFromMethod));
+
+        final Facet facet1 = facetedMethod.getFacet(CollectionValidateRemoveFromFacet.class);
+        assertNotNull(facet1);
+        assertTrue(facet1 instanceof CollectionValidateRemoveFromFacetViaMethod);
+        final CollectionValidateRemoveFromFacetViaMethod collectionValidateRemoveFromFacetViaMethod = (CollectionValidateRemoveFromFacetViaMethod) facet1;
+        assertEquals(validateRemoveFromMethod, collectionValidateRemoveFromFacetViaMethod.getMethods().get(0));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(validateRemoveFromMethod));
+    }
+
+    static class Order {
+    }
+
+    public static class CustomerStatic {
+        public Collection<Order> getOrders() {
+            return null;
+        }
+
+        public static String nameOrders() {
+            return "Most Recent Orders";
+        };
+
+        public static String descriptionOrders() {
+            return "Some old description";
+        }
+
+        public static boolean alwaysHideOrders() {
+            return true;
+        }
+
+        public static boolean protectOrders() {
+            return true;
+        }
+
+        public static boolean hideOrders(final UserMemento userMemento) {
+            return true;
+        }
+
+        public static String disableOrders(final UserMemento userMemento) {
+            return "disabled for this user";
+        }
+
+        public static void getOtherOrders() {
+        }
+
+        public static boolean alwaysHideOtherOrders() {
+            return false;
+        }
+
+        public static boolean protectOtherOrders() {
+            return false;
+        }
+    }
+
+    public void testInstallsNamedFacetUsingNameMethodAndRemovesMethod() {
+        final NamedFacetViaNameMethodFacetFactory facetFactory = new NamedFacetViaNameMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        final Method collectionAccessorMethod = findMethod(CustomerStatic.class, "getOrders");
+        final Method nameMethod = findMethod(CustomerStatic.class, "nameOrders");
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(NamedFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof NamedFacetViaMethod);
+        final NamedFacetViaMethod namedFacet = (NamedFacetViaMethod) facet;
+        assertEquals("Most Recent Orders", namedFacet.value());
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(nameMethod));
+    }
+
+    public void testInstallsDescribedAsFacetUsingDescriptionAndRemovesMethod() {
+        final DescribedAsFacetViaDescriptionMethodFacetFactory facetFactory = new DescribedAsFacetViaDescriptionMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        final Method collectionAccessorMethod = findMethod(CustomerStatic.class, "getOrders");
+        final Method descriptionMethod = findMethod(CustomerStatic.class, "descriptionOrders");
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(DescribedAsFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof DescribedAsFacetViaMethod);
+        final DescribedAsFacetViaMethod describedAsFacet = (DescribedAsFacetViaMethod) facet;
+        assertEquals("Some old description", describedAsFacet.value());
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(descriptionMethod));
+    }
+
+    public void testInstallsHiddenFacetUsingAlwaysHideAndRemovesMethod() {
+        final HiddenFacetViaAlwaysHideMethodFacetFactory facetFactory = new HiddenFacetViaAlwaysHideMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        final Method collectionAccessorMethod = findMethod(CustomerStatic.class, "getOrders");
+        final Method alwaysHideMethod = findMethod(CustomerStatic.class, "alwaysHideOrders");
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(HiddenFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof HiddenFacetAlways);
+        final HiddenFacetAbstract hiddenFacetAlways = (HiddenFacetAlways) facet;
+        assertEquals(When.ALWAYS, hiddenFacetAlways.value());
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(alwaysHideMethod));
+    }
+
+    public void testInstallsHiddenFacetUsingAlwaysHideWhenNotAndRemovesMethod() {
+        final HiddenFacetViaAlwaysHideMethodFacetFactory facetFactory = new HiddenFacetViaAlwaysHideMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        final Method collectionAccessorMethod = findMethod(CustomerStatic.class, "getOtherOrders");
+        final Method alwaysHideMethod = findMethod(CustomerStatic.class, "alwaysHideOtherOrders");
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        assertNull(facetedMethod.getFacet(HiddenFacet.class));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(alwaysHideMethod));
+    }
+
+    public void testInstallsDisabledFacetUsingProtectAndRemovesMethod() {
+        final DisabledFacetViaProtectMethodFacetFactory facetFactory = new DisabledFacetViaProtectMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        final Method collectionAccessorMethod = findMethod(CustomerStatic.class, "getOrders");
+        final Method protectMethod = findMethod(CustomerStatic.class, "protectOrders");
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof DisabledFacetAlways);
+        final DisabledFacetAlways disabledFacetAlways = (DisabledFacetAlways) facet;
+        assertEquals(When.ALWAYS, disabledFacetAlways.value());
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(protectMethod));
+    }
+
+    public void testDoesNotInstallDisabledFacetUsingProtectWhenNotAndRemovesMethod() {
+        final DisabledFacetViaProtectMethodFacetFactory facetFactory = new DisabledFacetViaProtectMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        final Method collectionAccessorMethod = findMethod(CustomerStatic.class, "getOtherOrders");
+        final Method protectMethod = findMethod(CustomerStatic.class, "protectOtherOrders");
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        assertNull(facetedMethod.getFacet(DisabledFacet.class));
+
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().contains(protectMethod));
+    }
+
+    public void testInstallsHiddenForSessionFacetAndRemovesMethod() {
+        final HiddenFacetViaHideForSessionMethodFacetFactory facetFactory = new HiddenFacetViaHideForSessionMethodFacetFactory();
+        facetFactory.setSpecificationLookup(reflector);
+
+        final Method collectionAccessorMethod = findMethod(CustomerStatic.class, "getOrders");
+        final Method hideMethod = findMethod(CustomerStatic.class, "hideOrders", new Class[] { UserMemento.class });
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, 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);
+
+        final Method collectionAccessorMethod = findMethod(CustomerStatic.class, "getOrders");
+        final Method disableMethod = findMethod(CustomerStatic.class, "disableOrders", new Class[] { UserMemento.class });
+
+        facetFactory.process(new ProcessMethodContext(CustomerStatic.class, collectionAccessorMethod, 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));
+    }
+
+}

Modified: incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/collections/JavaCollectionFacetTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/collections/JavaCollectionFacetTest.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/collections/JavaCollectionFacetTest.java (original)
+++ incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/collections/JavaCollectionFacetTest.java Sun Jan 22 06:58:43 2012
@@ -17,9 +17,8 @@
  *  under the License.
  */
 
+package org.apache.isis.core.progmodel.facets.collections;
 
-package org.apache.isis.core.progmodel.facets.collections;
-
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertThat;
@@ -27,6 +26,10 @@ import static org.junit.Assert.assertTha
 import java.util.Collection;
 import java.util.Iterator;
 
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.map.AdapterMap;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.collections.collection.JavaCollectionFacet;
 import org.jmock.Expectations;
 import org.jmock.Mockery;
 import org.jmock.integration.junit4.JMock;
@@ -36,61 +39,55 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.map.AdapterMap;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.progmodel.facets.collections.collection.JavaCollectionFacet;
-
-
-@RunWith(JMock.class)
-public class JavaCollectionFacetTest  {
-
-    private JavaCollectionFacet facet;
-
-    private Mockery mockery = new JUnit4Mockery();
-
-    private FacetHolder mockFacetHolder;
-    
-    private ObjectAdapter mockCollection;
-    private Collection<ObjectAdapter> mockWrappedCollection;
-    private Iterator<ObjectAdapter> mockIterator;
-
-    private AdapterMap mockAdapterManager;
-    
-    @Before
-    public void setUp() throws Exception {
-        mockFacetHolder = mockery.mock(FacetHolder.class);
-        mockCollection = mockery.mock(ObjectAdapter.class);
-        mockWrappedCollection = mockery.mock(Collection.class);
-        mockIterator = mockery.mock(Iterator.class);
-        mockAdapterManager = mockery.mock(AdapterMap.class);
-
-        facet = new JavaCollectionFacet(mockFacetHolder, mockAdapterManager);
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        facet = null;
-    }
-
-    @Test
-    public void firstElementForEmptyCollectionIsNull() {
-        mockery.checking(new Expectations(){{
-            one(mockCollection).getObject();
-            will(returnValue(mockWrappedCollection));
-            
-            one(mockWrappedCollection).size();
-            will(returnValue(0));
-
-            one(mockWrappedCollection).iterator();
-            will(returnValue(mockIterator));
-
-            one(mockIterator).hasNext();
-            will(returnValue(false));
-        }});
-        assertThat(facet.firstElement(mockCollection), is(nullValue()));
-    }
-
-
-}
-
+@RunWith(JMock.class)
+public class JavaCollectionFacetTest {
+
+    private JavaCollectionFacet facet;
+
+    private final Mockery mockery = new JUnit4Mockery();
+
+    private FacetHolder mockFacetHolder;
+
+    private ObjectAdapter mockCollection;
+    private Collection<ObjectAdapter> mockWrappedCollection;
+    private Iterator<ObjectAdapter> mockIterator;
+
+    private AdapterMap mockAdapterManager;
+
+    @Before
+    public void setUp() throws Exception {
+        mockFacetHolder = mockery.mock(FacetHolder.class);
+        mockCollection = mockery.mock(ObjectAdapter.class);
+        mockWrappedCollection = mockery.mock(Collection.class);
+        mockIterator = mockery.mock(Iterator.class);
+        mockAdapterManager = mockery.mock(AdapterMap.class);
+
+        facet = new JavaCollectionFacet(mockFacetHolder, mockAdapterManager);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        facet = null;
+    }
+
+    @Test
+    public void firstElementForEmptyCollectionIsNull() {
+        mockery.checking(new Expectations() {
+            {
+                one(mockCollection).getObject();
+                will(returnValue(mockWrappedCollection));
+
+                one(mockWrappedCollection).size();
+                will(returnValue(0));
+
+                one(mockWrappedCollection).iterator();
+                will(returnValue(mockIterator));
+
+                one(mockIterator).hasNext();
+                will(returnValue(false));
+            }
+        });
+        assertThat(facet.firstElement(mockCollection), is(nullValue()));
+    }
+
+}

Modified: incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/disable/DisabledAnnotationFacetFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/disable/DisabledAnnotationFacetFactoryTest.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/disable/DisabledAnnotationFacetFactoryTest.java (original)
+++ incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/disable/DisabledAnnotationFacetFactoryTest.java Sun Jan 22 06:58:43 2012
@@ -17,9 +17,8 @@
  *  under the License.
  */
 
+package org.apache.isis.core.progmodel.facets.disable;
 
-package org.apache.isis.core.progmodel.facets.disable;
-
 import java.lang.reflect.Method;
 import java.util.Collection;
 
@@ -31,138 +30,140 @@ import org.apache.isis.core.progmodel.fa
 import org.apache.isis.core.progmodel.facets.members.disable.DisabledFacet;
 import org.apache.isis.core.progmodel.facets.members.disable.DisabledFacetAbstract;
 import org.apache.isis.core.progmodel.facets.members.disable.annotation.DisabledAnnotationFacetFactory;
-
-
-public class DisabledAnnotationFacetFactoryTest extends AbstractFacetFactoryTest {
-
-    private DisabledAnnotationFacetFactory facetFactory;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        facetFactory = new DisabledAnnotationFacetFactory();
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        facetFactory = null;
-        super.tearDown();
-    }
-
-
-    public void testDisabledAnnotationPickedUpOnProperty() {
-        class Customer {
-            @Disabled
-            public int getNumberOfOrders() {
-                return 0;
-            }
-        }
-        final Method actionMethod = findMethod(Customer.class, "getNumberOfOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof DisabledFacetAbstract);
-
-        assertNoMethodsRemoved();
-    }
-
-    public void testDisabledAnnotationPickedUpOnCollection() {
-        class Customer {
-            @Disabled
-            public Collection getOrders() {
-                return null;
-            }
-        }
-        final Method actionMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof DisabledFacetAbstract);
-
-        assertNoMethodsRemoved();
-    }
-
-    public void testDisabledAnnotationPickedUpOnAction() {
-        class Customer {
-            @Disabled
-            public void someAction() {}
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof DisabledFacetAbstract);
-
-        assertNoMethodsRemoved();
-    }
-
-    public void testDisabledWhenAlwaysAnnotationPickedUpOn() {
-        class Customer {
-            @Disabled(When.ALWAYS)
-            public void someAction() {}
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
-        final DisabledFacetAbstract disabledFacetAbstract = (DisabledFacetAbstract) facet;
-
-        assertEquals(org.apache.isis.core.metamodel.facets.When.ALWAYS, disabledFacetAbstract.value());
-    }
-
-    public void testDisabledWhenNeverAnnotationPickedUpOn() {
-        class Customer {
-            @Disabled(When.NEVER)
-            public void someAction() {}
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
-        final DisabledFacetAbstract disabledFacetAbstract = (DisabledFacetAbstract) facet;
-
-        assertEquals(org.apache.isis.core.metamodel.facets.When.NEVER, disabledFacetAbstract.value());
-    }
-
-    public void testDisabledWhenOncePersistedAnnotationPickedUpOn() {
-        class Customer {
-            @Disabled(When.ONCE_PERSISTED)
-            public void someAction() {}
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
-        final DisabledFacetAbstract disabledFacetAbstract = (DisabledFacetAbstract) facet;
-
-        assertEquals(org.apache.isis.core.metamodel.facets.When.ONCE_PERSISTED, disabledFacetAbstract.value());
-    }
-
-    public void testDisabledWhenUntilPersistedAnnotationPickedUpOn() {
-        class Customer {
-            @SuppressWarnings("unused")
-            @Disabled(When.UNTIL_PERSISTED)
-            public void someAction() {}
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
-        final DisabledFacetAbstract disabledFacetAbstract = (DisabledFacetAbstract) facet;
-
-        assertEquals(org.apache.isis.core.metamodel.facets.When.UNTIL_PERSISTED, disabledFacetAbstract.value());
-    }
-
-}
-
+
+public class DisabledAnnotationFacetFactoryTest extends AbstractFacetFactoryTest {
+
+    private DisabledAnnotationFacetFactory facetFactory;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        facetFactory = new DisabledAnnotationFacetFactory();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        facetFactory = null;
+        super.tearDown();
+    }
+
+    public void testDisabledAnnotationPickedUpOnProperty() {
+        class Customer {
+            @Disabled
+            public int getNumberOfOrders() {
+                return 0;
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "getNumberOfOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof DisabledFacetAbstract);
+
+        assertNoMethodsRemoved();
+    }
+
+    public void testDisabledAnnotationPickedUpOnCollection() {
+        class Customer {
+            @Disabled
+            public Collection getOrders() {
+                return null;
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof DisabledFacetAbstract);
+
+        assertNoMethodsRemoved();
+    }
+
+    public void testDisabledAnnotationPickedUpOnAction() {
+        class Customer {
+            @Disabled
+            public void someAction() {
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof DisabledFacetAbstract);
+
+        assertNoMethodsRemoved();
+    }
+
+    public void testDisabledWhenAlwaysAnnotationPickedUpOn() {
+        class Customer {
+            @Disabled(When.ALWAYS)
+            public void someAction() {
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
+        final DisabledFacetAbstract disabledFacetAbstract = (DisabledFacetAbstract) facet;
+
+        assertEquals(org.apache.isis.core.metamodel.facets.When.ALWAYS, disabledFacetAbstract.value());
+    }
+
+    public void testDisabledWhenNeverAnnotationPickedUpOn() {
+        class Customer {
+            @Disabled(When.NEVER)
+            public void someAction() {
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
+        final DisabledFacetAbstract disabledFacetAbstract = (DisabledFacetAbstract) facet;
+
+        assertEquals(org.apache.isis.core.metamodel.facets.When.NEVER, disabledFacetAbstract.value());
+    }
+
+    public void testDisabledWhenOncePersistedAnnotationPickedUpOn() {
+        class Customer {
+            @Disabled(When.ONCE_PERSISTED)
+            public void someAction() {
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
+        final DisabledFacetAbstract disabledFacetAbstract = (DisabledFacetAbstract) facet;
+
+        assertEquals(org.apache.isis.core.metamodel.facets.When.ONCE_PERSISTED, disabledFacetAbstract.value());
+    }
+
+    public void testDisabledWhenUntilPersistedAnnotationPickedUpOn() {
+        class Customer {
+            @SuppressWarnings("unused")
+            @Disabled(When.UNTIL_PERSISTED)
+            public void someAction() {
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(DisabledFacet.class);
+        final DisabledFacetAbstract disabledFacetAbstract = (DisabledFacetAbstract) facet;
+
+        assertEquals(org.apache.isis.core.metamodel.facets.When.UNTIL_PERSISTED, disabledFacetAbstract.value());
+    }
+
+}



Mime
View raw message