incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1096446 - in /incubator/isis/trunk/core/testsupport/src: main/java/org/apache/isis/core/testsupport/jmock/ main/java/org/apache/isis/core/testsupport/testdomain/ main/java/org/apache/isis/core/testsupport/value/ test/java/org/apache/isis/c...
Date Mon, 25 Apr 2011 09:53:11 GMT
Author: danhaywood
Date: Mon Apr 25 09:53:10 2011
New Revision: 1096446

URL: http://svn.apache.org/viewvc?rev=1096446&view=rev
Log:
ISIS-22: code cleanup of core.testsupport

Modified:
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/AbstractJMockForClassesTest.java
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/AbstractJMockForInterfacesTest.java
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/AbstractJMockTest.java
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ConvenienceMockery.java
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/DelegatingMockery.java
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/Fixture.java
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/FixtureMockery.java
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/InjectIntoJMockAction.java
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JMockContextBuilder.java
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JMockRule.java
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/MockFixture.java
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/MockFixtureAdapter.java
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ReturnArgumentJMockAction.java
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Movie.java
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Person.java
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Role.java
    incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract.java
    incubator/isis/trunk/core/testsupport/src/test/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract_BigIntegerTest.java
    incubator/isis/trunk/core/testsupport/src/test/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract_StringTest.java

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/AbstractJMockForClassesTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/AbstractJMockForClassesTest.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/AbstractJMockForClassesTest.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/AbstractJMockForClassesTest.java Mon Apr 25 09:53:10 2011
@@ -17,15 +17,15 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.testsupport.jmock;
 
-
 public abstract class AbstractJMockForClassesTest extends AbstractJMockTest {
 
-	protected ConvenienceMockery context = JMockContextBuilder.classMockingContext();
+    protected ConvenienceMockery context = JMockContextBuilder.classMockingContext();
+
+    @Override
     protected ConvenienceMockery getContext() {
-    	return context;
+        return context;
     }
 
 }

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/AbstractJMockForInterfacesTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/AbstractJMockForInterfacesTest.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/AbstractJMockForInterfacesTest.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/AbstractJMockForInterfacesTest.java Mon Apr 25 09:53:10 2011
@@ -17,15 +17,14 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.testsupport.jmock;
 
-
 public abstract class AbstractJMockForInterfacesTest extends AbstractJMockTest {
 
     protected ConvenienceMockery context = JMockContextBuilder.interfaceMockingContext();
 
+    @Override
     protected ConvenienceMockery getContext() {
-    	return context;
+        return context;
     }
 }

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/AbstractJMockTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/AbstractJMockTest.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/AbstractJMockTest.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/AbstractJMockTest.java Mon Apr 25 09:53:10 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.testsupport.jmock;
 
 import org.junit.Rule;
@@ -31,21 +30,21 @@ public abstract class AbstractJMockTest 
      */
     @Rule
     public JMockRule jmockRule = new JMockRule();
-    
+
     protected void ignoring(final Object mock) {
-    	getContext().ignoring(mock);
+        getContext().ignoring(mock);
     }
 
     protected void allowing(final Object mock) {
-    	getContext().allowing(mock);
+        getContext().allowing(mock);
     }
 
     protected void never(final Object mock) {
-    	getContext().never(mock);
+        getContext().never(mock);
     }
 
     protected void prohibit(final Object mock) {
-    	getContext().prohibit(mock);
+        getContext().prohibit(mock);
     }
 
 }

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ConvenienceMockery.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ConvenienceMockery.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ConvenienceMockery.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ConvenienceMockery.java Mon Apr 25 09:53:10 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.testsupport.jmock;
 
 import org.jmock.Expectations;
@@ -27,26 +26,24 @@ import org.jmock.Mockery;
  * Adds some convenience methods to {@link Mockery}.
  */
 public abstract class ConvenienceMockery extends Mockery {
-	
+
     /**
-     * Ignoring any interaction with the mock; an allowing/ignoring mock will be
-     * returned in turn.
+     * Ignoring any interaction with the mock; an allowing/ignoring mock will be returned in turn.
      */
     public void ignoring(final Object mock) {
         checking(new Expectations() {
-        {
+            {
                 ignoring(mock);
             }
         });
     }
 
     /**
-     * Allow any interaction with the mock; an allowing mock will be
-     * returned in turn.
+     * Allow any interaction with the mock; an allowing mock will be returned in turn.
      */
     public void allowing(final Object mock) {
         checking(new Expectations() {
-        {
+            {
                 allowing(mock);
             }
         });
@@ -57,7 +54,7 @@ public abstract class ConvenienceMockery
      */
     public void never(final Object mock) {
         checking(new Expectations() {
-        {
+            {
                 never(mock);
             }
         });
@@ -67,69 +64,80 @@ public abstract class ConvenienceMockery
      * Same as {@link #never(Object)}.
      */
     public void prohibit(final Object mock) {
-    	never(mock);
+        never(mock);
+    }
+
+    public <T> T mockAndIgnoreAnyInteraction(final Class<T> typeToMock) {
+        final T mock = mock(typeToMock);
+        checking(new Expectations() {
+            {
+                ignoring(mock);
+            }
+        });
+        return mock;
     }
 
-	public <T> T mockAndIgnoreAnyInteraction(Class<T> typeToMock) {
-		final T mock = mock(typeToMock);
-		checking(new Expectations(){{
-			ignoring(mock);
-		}});
-		return mock;
-	}
-	
-	public <T> T mockAndIgnoreAnyInteraction(Class<T> typeToMock, String name) {
-		final T mock = mock(typeToMock, name);
-		checking(new Expectations(){{
-			ignoring(mock);
-		}});
-		return mock;
-	}
-	
-	public <T> T mockAndAllowAnyInteraction(Class<T> typeToMock) {
-		final T mock = mock(typeToMock);
-		checking(new Expectations(){{
-			allowing(mock);
-		}});
-		return mock;
-	}
-	
-	public <T> T mockAndAllowAnyInteraction(Class<T> typeToMock, String name) {
-		final T mock = mock(typeToMock, name);
-		checking(new Expectations(){{
-			allowing(mock);
-		}});
-		return mock;
-	}
-	
-	public <T> T mockAndNeverAnyInteraction(Class<T> typeToMock) {
-		final T mock = mock(typeToMock);
-		checking(new Expectations(){{
-			never(mock);
-		}});
-		return mock;
-	}
-	
-	public <T> T mockAndNeverAnyInteraction(Class<T> typeToMock, String name) {
-		final T mock = mock(typeToMock, name);
-		checking(new Expectations(){{
-			never(mock);
-		}});
-		return mock;
-	}
-	
-
-	/**
-	 * Same as {@link #mockAndNeverAnyInteraction(Class)}.
-	 */
-	public <T> T mockAndProhibitAnyInteraction(Class<T> typeToMock) {
-		return mockAndNeverAnyInteraction(typeToMock);
-	}
-	
-	/**
-	 * Same as {@link #mockAndNeverAnyInteraction(Class, String)}.
-	 */
-	public <T> T mockAndProhibitAnyInteraction(Class<T> typeToMock, String name) {
-		return mockAndNeverAnyInteraction(typeToMock, name);
-	}
+    public <T> T mockAndIgnoreAnyInteraction(final Class<T> typeToMock, final String name) {
+        final T mock = mock(typeToMock, name);
+        checking(new Expectations() {
+            {
+                ignoring(mock);
+            }
+        });
+        return mock;
+    }
+
+    public <T> T mockAndAllowAnyInteraction(final Class<T> typeToMock) {
+        final T mock = mock(typeToMock);
+        checking(new Expectations() {
+            {
+                allowing(mock);
+            }
+        });
+        return mock;
+    }
+
+    public <T> T mockAndAllowAnyInteraction(final Class<T> typeToMock, final String name) {
+        final T mock = mock(typeToMock, name);
+        checking(new Expectations() {
+            {
+                allowing(mock);
+            }
+        });
+        return mock;
+    }
+
+    public <T> T mockAndNeverAnyInteraction(final Class<T> typeToMock) {
+        final T mock = mock(typeToMock);
+        checking(new Expectations() {
+            {
+                never(mock);
+            }
+        });
+        return mock;
+    }
+
+    public <T> T mockAndNeverAnyInteraction(final Class<T> typeToMock, final String name) {
+        final T mock = mock(typeToMock, name);
+        checking(new Expectations() {
+            {
+                never(mock);
+            }
+        });
+        return mock;
+    }
+
+    /**
+     * Same as {@link #mockAndNeverAnyInteraction(Class)}.
+     */
+    public <T> T mockAndProhibitAnyInteraction(final Class<T> typeToMock) {
+        return mockAndNeverAnyInteraction(typeToMock);
+    }
+
+    /**
+     * Same as {@link #mockAndNeverAnyInteraction(Class, String)}.
+     */
+    public <T> T mockAndProhibitAnyInteraction(final Class<T> typeToMock, final String name) {
+        return mockAndNeverAnyInteraction(typeToMock, name);
+    }
 }

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/DelegatingMockery.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/DelegatingMockery.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/DelegatingMockery.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/DelegatingMockery.java Mon Apr 25 09:53:10 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.testsupport.jmock;
 
 import org.hamcrest.Description;
@@ -33,83 +32,81 @@ import org.jmock.internal.ExpectationBui
 
 /**
  * Simply delegates to underlying {@link Mockery}.
- *
+ * 
  * <p>
- * Designed to make it easy to write custom {@link Mockery} implementations, while
- * delegating most of the actual work to an existing {@link Mockery} implementation.
+ * Designed to make it easy to write custom {@link Mockery} implementations, while delegating most of the actual work to
+ * an existing {@link Mockery} implementation.
  */
 public class DelegatingMockery extends ConvenienceMockery {
-	
-	private Mockery underlying;
-	
-	public DelegatingMockery(Mockery underlying) {
-		this.underlying = underlying; 
-	}
-	
-	public DelegatingMockery() {
-		this(new JUnit4Mockery()); 
-	}
-	
-	@Override
-	public void addExpectation(Expectation expectation) {
-		underlying.addExpectation(expectation);
-	}
-	
-	@Override
-	public void assertIsSatisfied() {
-		underlying.assertIsSatisfied();
-	}
-	
-	@Override
-	public void checking(ExpectationBuilder expectations) {
-		underlying.checking(expectations);
-	}
-	
-	@Override
-	public void describeTo(Description description) {
-		underlying.describeTo(description);
-	}
-
-	@Override
-	public <T> T mock(Class<T> typeToMock) {
-		return underlying.mock(typeToMock);
-	}
-	
-	@Override
-	public <T> T mock(Class<T> typeToMock, String name) {
-		return underlying.mock(typeToMock, name);
-	}
-	
-	@Override
-	public Sequence sequence(String name) {
-		return underlying.sequence(name);
-	}
-	
-	@Override
-	public void setDefaultResultForType(Class<?> type, Object result) {
-		underlying.setDefaultResultForType(type, result);
-	}
-	
-	@Override
-	public void setExpectationErrorTranslator(
-			ExpectationErrorTranslator expectationErrorTranslator) {
-		underlying.setExpectationErrorTranslator(expectationErrorTranslator);
-	}
-	
-	@Override
-	public void setImposteriser(Imposteriser imposteriser) {
-		underlying.setImposteriser(imposteriser);
-	}
-	
-	@Override
-	public void setNamingScheme(MockObjectNamingScheme namingScheme) {
-		underlying.setNamingScheme(namingScheme);
-	}
-	
-	@Override
-	public States states(String name) {
-		return underlying.states(name);
-	}
-	
-	
+
+    private final Mockery underlying;
+
+    public DelegatingMockery(final Mockery underlying) {
+        this.underlying = underlying;
+    }
+
+    public DelegatingMockery() {
+        this(new JUnit4Mockery());
+    }
+
+    @Override
+    public void addExpectation(final Expectation expectation) {
+        underlying.addExpectation(expectation);
+    }
+
+    @Override
+    public void assertIsSatisfied() {
+        underlying.assertIsSatisfied();
+    }
+
+    @Override
+    public void checking(final ExpectationBuilder expectations) {
+        underlying.checking(expectations);
+    }
+
+    @Override
+    public void describeTo(final Description description) {
+        underlying.describeTo(description);
+    }
+
+    @Override
+    public <T> T mock(final Class<T> typeToMock) {
+        return underlying.mock(typeToMock);
+    }
+
+    @Override
+    public <T> T mock(final Class<T> typeToMock, final String name) {
+        return underlying.mock(typeToMock, name);
+    }
+
+    @Override
+    public Sequence sequence(final String name) {
+        return underlying.sequence(name);
+    }
+
+    @Override
+    public void setDefaultResultForType(final Class<?> type, final Object result) {
+        underlying.setDefaultResultForType(type, result);
+    }
+
+    @Override
+    public void setExpectationErrorTranslator(final ExpectationErrorTranslator expectationErrorTranslator) {
+        underlying.setExpectationErrorTranslator(expectationErrorTranslator);
+    }
+
+    @Override
+    public void setImposteriser(final Imposteriser imposteriser) {
+        underlying.setImposteriser(imposteriser);
+    }
+
+    @Override
+    public void setNamingScheme(final MockObjectNamingScheme namingScheme) {
+        underlying.setNamingScheme(namingScheme);
+    }
+
+    @Override
+    public States states(final String name) {
+        return underlying.states(name);
+    }
+
 }

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/Fixture.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/Fixture.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/Fixture.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/Fixture.java Mon Apr 25 09:53:10 2011
@@ -17,16 +17,15 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.testsupport.jmock;
 
 /**
- * Represents something to be setup within a test; typically a collaborator of some
- * sort to the object under test.
+ * Represents something to be setup within a test; typically a collaborator of some sort to the object under test.
  */
 public interface Fixture<C extends Fixture.Context> {
-	
-	interface Context {}
-	
-	public void setUp(C fixtureContext);
+
+    interface Context {
+    }
+
+    public void setUp(C fixtureContext);
 }

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/FixtureMockery.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/FixtureMockery.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/FixtureMockery.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/FixtureMockery.java Mon Apr 25 09:53:10 2011
@@ -17,37 +17,34 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.testsupport.jmock;
 
-
-import org.jmock.Mockery;
 import org.apache.isis.core.testsupport.jmock.MockFixture.Builder;
+import org.jmock.Mockery;
 
 public class FixtureMockery extends DelegatingMockery {
-	
-	public FixtureMockery(Mockery underlying) {
-		super(underlying); 
-	}
-	
-	public FixtureMockery() {
-		super(); 
-	}
-	
-	public <T extends MockFixture<?>> T fixture(Class<T> fixtureClass) {
-		final Builder<T> fixtureBuilder = fixtureBuilder(fixtureClass);
-		return fixtureBuilder.build();
-	}
-	
-	public <T extends MockFixture<?>> T fixture(Class<T> fixtureClass, String name) {
-		final Builder<T> fixtureBuilder = fixtureBuilder(fixtureClass);
-		fixtureBuilder.named(name);
-		return fixtureBuilder.build();
-	}
-
-	public <T extends MockFixture<?>> MockFixture.Builder<T> fixtureBuilder(Class<T> fixtureClass) {
-		return new MockFixture.Builder<T>(this, fixtureClass);
-	}
-	
+
+    public FixtureMockery(final Mockery underlying) {
+        super(underlying);
+    }
+
+    public FixtureMockery() {
+        super();
+    }
+
+    public <T extends MockFixture<?>> T fixture(final Class<T> fixtureClass) {
+        final Builder<T> fixtureBuilder = fixtureBuilder(fixtureClass);
+        return fixtureBuilder.build();
+    }
+
+    public <T extends MockFixture<?>> T fixture(final Class<T> fixtureClass, final String name) {
+        final Builder<T> fixtureBuilder = fixtureBuilder(fixtureClass);
+        fixtureBuilder.named(name);
+        return fixtureBuilder.build();
+    }
+
+    public <T extends MockFixture<?>> MockFixture.Builder<T> fixtureBuilder(final Class<T> fixtureClass) {
+        return new MockFixture.Builder<T>(this, fixtureClass);
+    }
 
 }

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/InjectIntoJMockAction.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/InjectIntoJMockAction.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/InjectIntoJMockAction.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/InjectIntoJMockAction.java Mon Apr 25 09:53:10 2011
@@ -17,47 +17,47 @@
  *  under the License.
  */
 
+package org.apache.isis.core.testsupport.jmock;
 
-package org.apache.isis.core.testsupport.jmock;
-
-import java.lang.reflect.Method;
-
-import org.hamcrest.Description;
-import org.jmock.api.Action;
-import org.jmock.api.Invocation;
-
-public final class InjectIntoJMockAction implements Action {
-    public void describeTo(Description description) {
-        description.appendText("inject self");
-    }
-
-    // x.injectInto(y) ---> y.setXxx(x)
-    public Object invoke(Invocation invocation) throws Throwable {
-        Object injectable = invocation.getInvokedObject();
-        Object toInjectInto = invocation.getParameter(0);
-        Method[] methods = toInjectInto.getClass().getMethods();
-        for(Method method: methods) {
-            if (!method.getName().startsWith("set")) {
-                continue;
-            } 
-            if (method.getParameterTypes().length != 1) {
-                continue;
-            }
-            Class<?> methodParameterType = method.getParameterTypes()[0];
-            if (methodParameterType.isAssignableFrom(injectable.getClass())) {
-                method.invoke(toInjectInto, injectable);
-                break;
-            }
-        }
-        return null;
-    }
-    
-    /**
-     * Factory
-     */
-    public static Action injectInto() {
-    	return new InjectIntoJMockAction();
-    }
-
-}
-
+import java.lang.reflect.Method;
+
+import org.hamcrest.Description;
+import org.jmock.api.Action;
+import org.jmock.api.Invocation;
+
+public final class InjectIntoJMockAction implements Action {
+    @Override
+    public void describeTo(final Description description) {
+        description.appendText("inject self");
+    }
+
+    // x.injectInto(y) ---> y.setXxx(x)
+    @Override
+    public Object invoke(final Invocation invocation) throws Throwable {
+        final Object injectable = invocation.getInvokedObject();
+        final Object toInjectInto = invocation.getParameter(0);
+        final Method[] methods = toInjectInto.getClass().getMethods();
+        for (final Method method : methods) {
+            if (!method.getName().startsWith("set")) {
+                continue;
+            }
+            if (method.getParameterTypes().length != 1) {
+                continue;
+            }
+            final Class<?> methodParameterType = method.getParameterTypes()[0];
+            if (methodParameterType.isAssignableFrom(injectable.getClass())) {
+                method.invoke(toInjectInto, injectable);
+                break;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Factory
+     */
+    public static Action injectInto() {
+        return new InjectIntoJMockAction();
+    }
+
+}

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JMockContextBuilder.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JMockContextBuilder.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JMockContextBuilder.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JMockContextBuilder.java Mon Apr 25 09:53:10 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.testsupport.jmock;
 
 import org.jmock.Mockery;
@@ -26,89 +25,87 @@ import org.jmock.lib.legacy.ClassImposte
 
 public final class JMockContextBuilder {
 
-	public static enum Imposterising {
-		INTERFACE_ONLY {
-			@Override
-			public ConvenienceMockery setUp(ConvenienceMockery mockery) {
-				return mockery;
-			}
-		},
-		INTERFACES_AND_CLASSES {
-			@Override
-			public ConvenienceMockery setUp(ConvenienceMockery mockery) {
-				mockery.setImposteriser(ClassImposteriser.INSTANCE);
-				return mockery;
-			}
-		};
-
-		public abstract ConvenienceMockery setUp(ConvenienceMockery mockery);
-	}
-
-	public static enum MockFixtures {
-		SUPPORTED {
-			@Override
-			public ConvenienceMockery create(Imposterising imposterising,
-					Mockery underlying) {
-				FixtureMockery mockery = new FixtureMockery(underlyingOrDefault(underlying));
-				return imposterising.setUp(mockery);
-			}
-
-		},
-		NOT_SUPPORTED {
-			@Override
-			public ConvenienceMockery create(Imposterising imposterising,
-					Mockery underlying) {
-				DelegatingMockery mockery = new DelegatingMockery(underlyingOrDefault(underlying));
-				return imposterising.setUp(mockery);
-			}
-		};
-
-		abstract ConvenienceMockery create(Imposterising imposterising, Mockery underlying);
-		
-		private static Mockery underlyingOrDefault(Mockery underlying) {
-			return underlying != null ? underlying : new JUnit4Mockery();
-		}
-
-	}
-
-	public static JMockContextBuilder context() {
-		return new JMockContextBuilder();
-	}
-	
-	/**
-	 * Convenience factory for commonly-trod path.
-	 */
-	public static ConvenienceMockery interfaceMockingContext() {
-		return context().build();
-	}
-
-	/**
-	 * Convenience factory for commonly-trod path.
-	 */
-	public static ConvenienceMockery classMockingContext() {
-		return context().with(Imposterising.INTERFACES_AND_CLASSES).build();
-	}
-	
-	private Imposterising imposterising = Imposterising.INTERFACE_ONLY;
-	private MockFixtures mockFixtures = MockFixtures.NOT_SUPPORTED;
-	private Mockery underlying = null;
-	
-	public JMockContextBuilder with(Imposterising imposterising) {
-		this.imposterising = imposterising;
-		return this;
-	}
-
-	public JMockContextBuilder with(MockFixtures mockFixtures) {
-		this.mockFixtures = mockFixtures;
-		return this;
-	}
-
-	public JMockContextBuilder delegatingTo(Mockery underlying) {
-		this.underlying = underlying;
-		return this;
-	}
-
-	public ConvenienceMockery build() {
-		return mockFixtures.create(imposterising, underlying);
-	}
+    public static enum Imposterising {
+        INTERFACE_ONLY {
+            @Override
+            public ConvenienceMockery setUp(final ConvenienceMockery mockery) {
+                return mockery;
+            }
+        },
+        INTERFACES_AND_CLASSES {
+            @Override
+            public ConvenienceMockery setUp(final ConvenienceMockery mockery) {
+                mockery.setImposteriser(ClassImposteriser.INSTANCE);
+                return mockery;
+            }
+        };
+
+        public abstract ConvenienceMockery setUp(ConvenienceMockery mockery);
+    }
+
+    public static enum MockFixtures {
+        SUPPORTED {
+            @Override
+            public ConvenienceMockery create(final Imposterising imposterising, final Mockery underlying) {
+                final FixtureMockery mockery = new FixtureMockery(underlyingOrDefault(underlying));
+                return imposterising.setUp(mockery);
+            }
+
+        },
+        NOT_SUPPORTED {
+            @Override
+            public ConvenienceMockery create(final Imposterising imposterising, final Mockery underlying) {
+                final DelegatingMockery mockery = new DelegatingMockery(underlyingOrDefault(underlying));
+                return imposterising.setUp(mockery);
+            }
+        };
+
+        abstract ConvenienceMockery create(Imposterising imposterising, Mockery underlying);
+
+        private static Mockery underlyingOrDefault(final Mockery underlying) {
+            return underlying != null ? underlying : new JUnit4Mockery();
+        }
+
+    }
+
+    public static JMockContextBuilder context() {
+        return new JMockContextBuilder();
+    }
+
+    /**
+     * Convenience factory for commonly-trod path.
+     */
+    public static ConvenienceMockery interfaceMockingContext() {
+        return context().build();
+    }
+
+    /**
+     * Convenience factory for commonly-trod path.
+     */
+    public static ConvenienceMockery classMockingContext() {
+        return context().with(Imposterising.INTERFACES_AND_CLASSES).build();
+    }
+
+    private Imposterising imposterising = Imposterising.INTERFACE_ONLY;
+    private MockFixtures mockFixtures = MockFixtures.NOT_SUPPORTED;
+    private Mockery underlying = null;
+
+    public JMockContextBuilder with(final Imposterising imposterising) {
+        this.imposterising = imposterising;
+        return this;
+    }
+
+    public JMockContextBuilder with(final MockFixtures mockFixtures) {
+        this.mockFixtures = mockFixtures;
+        return this;
+    }
+
+    public JMockContextBuilder delegatingTo(final Mockery underlying) {
+        this.underlying = underlying;
+        return this;
+    }
+
+    public ConvenienceMockery build() {
+        return mockFixtures.create(imposterising, underlying);
+    }
 }

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JMockRule.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JMockRule.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JMockRule.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/JMockRule.java Mon Apr 25 09:53:10 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.testsupport.jmock;
 
 import java.lang.reflect.Field;
@@ -40,16 +39,14 @@ public class JMockRule implements org.ju
     }
 
     /**
-     * Specify the {@link Mockery context} to verify (as opposed to searching for it
-     * reflectively).
+     * Specify the {@link Mockery context} to verify (as opposed to searching for it reflectively).
      */
-    public JMockRule(Mockery context) {
+    public JMockRule(final Mockery context) {
         this.context = context;
     }
 
     @Override
-    public Statement apply(final Statement base, final FrameworkMethod method,
-            final Object target) {
+    public Statement apply(final Statement base, final FrameworkMethod method, final Object target) {
         return new Statement() {
 
             @Override
@@ -60,7 +57,7 @@ public class JMockRule implements org.ju
 
             private void verifyMocks() {
                 final Mockery context = contextToVerifyIfAny();
-                if(context!=null) {
+                if (context != null) {
                     context.assertIsSatisfied();
                 } else {
                     throw new AssertionError("could not locate JMock context");
@@ -69,15 +66,14 @@ public class JMockRule implements org.ju
 
             private Mockery contextToVerifyIfAny() {
                 final Mockery context = JMockRule.this.context;
-                if (context!=null) {
+                if (context != null) {
                     return context;
                 }
                 return findContextReflectivelyIfAny();
             }
 
             private Mockery findContextReflectivelyIfAny() {
-                Class<?> clsToSearch = method.getMethod()
-                        .getDeclaringClass();
+                Class<?> clsToSearch = method.getMethod().getDeclaringClass();
                 do {
                     final Mockery mockery = findContextIfAny(clsToSearch, target);
                     if (mockery != null) {
@@ -90,15 +86,15 @@ public class JMockRule implements org.ju
 
             private Mockery findContextIfAny(final Class<?> cls, final Object target) {
                 final Field[] fields = cls.getDeclaredFields();
-                for (Field field : fields) {
+                for (final Field field : fields) {
                     final Class<?> type = field.getType();
                     if (Mockery.class.isAssignableFrom(type)) {
                         try {
                             field.setAccessible(true);
                             return (Mockery) field.get(target);
-                        } catch (IllegalArgumentException e) {
+                        } catch (final IllegalArgumentException e) {
                             continue;
-                        } catch (IllegalAccessException e) {
+                        } catch (final IllegalAccessException e) {
                             continue;
                         }
                     }

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/MockFixture.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/MockFixture.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/MockFixture.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/MockFixture.java Mon Apr 25 09:53:10 2011
@@ -17,67 +17,67 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.testsupport.jmock;
 
-
 /**
  * A subinterface of {@link Fixture} representing a mock collaborator to be setup.
  */
 public interface MockFixture<T> extends Fixture<MockFixture.Context> {
-	
-	public interface Context extends Fixture.Context {
 
-		FixtureMockery getMockery();
-		/**
-		 * Name to use for mock, if any.
-		 * 
-		 * <p>
-		 * If <tt>null</tt>, then uses the default name.
-		 */
-		String name();
-	}
-
-	public static class Builder<T extends MockFixture<?>> {
-
-		private final FixtureMockery mockery;
-		private T fixture;
-		private String name;
-		
-		public Builder(FixtureMockery mockery, Class<T> cls) {
-			this.mockery = mockery;
-			try {
-				fixture = cls.newInstance();
-			} catch (InstantiationException e) {
-				throw new IllegalArgumentException(e);
-			} catch (IllegalAccessException e) {
-				throw new IllegalArgumentException(e);
-			}
-
-		}
-		public Builder<T> named(String name) { 
-			this.name = name;
-			return this;
-		}
-		
-		public T build() {
-			final Context context = new Context() {
-
-				@Override
-				public FixtureMockery getMockery() {
-					return mockery;
-				}
-
-				@Override
-				public String name() {
-					return name;
-				}
-			};
-			fixture.setUp(context);
-			return fixture;
-		}
-	}
-	
-	T object();
+    public interface Context extends Fixture.Context {
+
+        FixtureMockery getMockery();
+
+        /**
+         * Name to use for mock, if any.
+         * 
+         * <p>
+         * If <tt>null</tt>, then uses the default name.
+         */
+        String name();
+    }
+
+    public static class Builder<T extends MockFixture<?>> {
+
+        private final FixtureMockery mockery;
+        private T fixture;
+        private String name;
+
+        public Builder(final FixtureMockery mockery, final Class<T> cls) {
+            this.mockery = mockery;
+            try {
+                fixture = cls.newInstance();
+            } catch (final InstantiationException e) {
+                throw new IllegalArgumentException(e);
+            } catch (final IllegalAccessException e) {
+                throw new IllegalArgumentException(e);
+            }
+
+        }
+
+        public Builder<T> named(final String name) {
+            this.name = name;
+            return this;
+        }
+
+        public T build() {
+            final Context context = new Context() {
+
+                @Override
+                public FixtureMockery getMockery() {
+                    return mockery;
+                }
+
+                @Override
+                public String name() {
+                    return name;
+                }
+            };
+            fixture.setUp(context);
+            return fixture;
+        }
+    }
+
+    T object();
 
 }

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/MockFixtureAdapter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/MockFixtureAdapter.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/MockFixtureAdapter.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/MockFixtureAdapter.java Mon Apr 25 09:53:10 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.testsupport.jmock;
 
 import org.jmock.Mockery;
@@ -27,20 +26,20 @@ import org.jmock.Mockery;
  */
 public abstract class MockFixtureAdapter<T> implements MockFixture<T> {
 
-	private T object;
-	
-	/**
-	 * Assumes that the mock created is the one to be {@link #object() returned}
-	 * (though subclass can override that if need be).
-	 */
-	protected T createMock(MockFixture.Context fixtureContext, Class<T> cls) {
-		final Mockery mockery = fixtureContext.getMockery();
-		final String name = fixtureContext.name();
-		return object = name!=null?mockery.mock(cls, name):mockery.mock(cls);
-	}
-
-	@Override
-	public T object() {
-		return object;
-	}
+    private T object;
+
+    /**
+     * Assumes that the mock created is the one to be {@link #object() returned} (though subclass can override that if
+     * need be).
+     */
+    protected T createMock(final MockFixture.Context fixtureContext, final Class<T> cls) {
+        final Mockery mockery = fixtureContext.getMockery();
+        final String name = fixtureContext.name();
+        return object = name != null ? mockery.mock(cls, name) : mockery.mock(cls);
+    }
+
+    @Override
+    public T object() {
+        return object;
+    }
 }
\ No newline at end of file

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ReturnArgumentJMockAction.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ReturnArgumentJMockAction.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ReturnArgumentJMockAction.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/jmock/ReturnArgumentJMockAction.java Mon Apr 25 09:53:10 2011
@@ -17,34 +17,34 @@
  *  under the License.
  */
 
+package org.apache.isis.core.testsupport.jmock;
 
-package org.apache.isis.core.testsupport.jmock;
-
-import org.hamcrest.Description;
-import org.jmock.api.Action;
-import org.jmock.api.Invocation;
-
-public final class ReturnArgumentJMockAction implements Action {
-    private final int i;
-
-    public ReturnArgumentJMockAction(int i) {
-        this.i = i;
-    }
-
-    public void describeTo(Description description) {
-        description.appendText("parameter #" + i + " ");
-    }
-
-    public Object invoke(Invocation invocation) throws Throwable {
-        return invocation.getParameter(i);
-    }
-
-    /**
-     * Factory
-     */
-    public static Action returnArgument(final int i) {
-    	return new ReturnArgumentJMockAction(i);
-    }
-
-}
-
+import org.hamcrest.Description;
+import org.jmock.api.Action;
+import org.jmock.api.Invocation;
+
+public final class ReturnArgumentJMockAction implements Action {
+    private final int i;
+
+    public ReturnArgumentJMockAction(final int i) {
+        this.i = i;
+    }
+
+    @Override
+    public void describeTo(final Description description) {
+        description.appendText("parameter #" + i + " ");
+    }
+
+    @Override
+    public Object invoke(final Invocation invocation) throws Throwable {
+        return invocation.getParameter(i);
+    }
+
+    /**
+     * Factory
+     */
+    public static Action returnArgument(final int i) {
+        return new ReturnArgumentJMockAction(i);
+    }
+
+}

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Movie.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Movie.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Movie.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Movie.java Mon Apr 25 09:53:10 2011
@@ -17,54 +17,51 @@
  *  under the License.
  */
 
+package org.apache.isis.core.testsupport.testdomain;
 
-package org.apache.isis.core.testsupport.testdomain;
-
 import java.util.List;
 
 import com.google.common.collect.Lists;
-
-
-public class Movie {
-    private Person director;
-    private String name;
-    private final List<Role> roles = Lists.newArrayList();
-
-    public void addToRoles(final Role role) {
-        roles.add(role);
-    }
-
-    public Person getDirector() {
-        return director;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public List<Role> getRoles() {
-        return roles;
-    }
-
-    public void removeFromRoles(final Role role) {
-        roles.remove(role);
-    }
-
-    public void setDirector(final Person director) {
-        this.director = director;
-    }
-
-    public void setName(final String name) {
-        this.name = name;
-    }
-
-    public String title() {
-        return name;
-    }
-
-    /*
-     * public static void aboutActionFindMovie(ActionAbout about, String name, Person director, Person actor) {
-     * about.setParameter(0, "Name"); about.setParameter(1, "Director"); about.setParameter(2, "Actor"); }
-     * 
-     */
-}
+
+public class Movie {
+    private Person director;
+    private String name;
+    private final List<Role> roles = Lists.newArrayList();
+
+    public void addToRoles(final Role role) {
+        roles.add(role);
+    }
+
+    public Person getDirector() {
+        return director;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public List<Role> getRoles() {
+        return roles;
+    }
+
+    public void removeFromRoles(final Role role) {
+        roles.remove(role);
+    }
+
+    public void setDirector(final Person director) {
+        this.director = director;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public String title() {
+        return name;
+    }
+
+    /*
+     * public static void aboutActionFindMovie(ActionAbout about, String name, Person director, Person actor) {
+     * about.setParameter(0, "Name"); about.setParameter(1, "Director"); about.setParameter(2, "Actor"); }
+     */
+}

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Person.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Person.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Person.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Person.java Mon Apr 25 09:53:10 2011
@@ -17,33 +17,31 @@
  *  under the License.
  */
 
+package org.apache.isis.core.testsupport.testdomain;
 
-package org.apache.isis.core.testsupport.testdomain;
-
-import java.util.Date;
-
-
-public class Person {
-    private Date date;
-    private String name;
-
-    public Date getDate() {
-        return date;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setDate(final Date date) {
-        this.date = date;
-    }
-
-    public void setName(final String name) {
-        this.name = name;
-    }
-
-    public String title() {
-        return name;
-    }
-}
+import java.util.Date;
+
+public class Person {
+    private Date date;
+    private String name;
+
+    public Date getDate() {
+        return date;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setDate(final Date date) {
+        this.date = date;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public String title() {
+        return name;
+    }
+}

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Role.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Role.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Role.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/testdomain/Role.java Mon Apr 25 09:53:10 2011
@@ -17,30 +17,29 @@
  *  under the License.
  */
 
+package org.apache.isis.core.testsupport.testdomain;
 
-package org.apache.isis.core.testsupport.testdomain;
-
-public class Role {
-    private Person actor;
-    private String name;
-
-    public Person getActor() {
-        return actor;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setActor(final Person actor) {
-        this.actor = actor;
-    }
-
-    public void setName(final String name) {
-        this.name = name;
-    }
-
-    public String title() {
-        return name;
-    }
-}
+public class Role {
+    private Person actor;
+    private String name;
+
+    public Person getActor() {
+        return actor;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setActor(final Person actor) {
+        this.actor = actor;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public String title() {
+        return name;
+    }
+}

Modified: incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract.java (original)
+++ incubator/isis/trunk/core/testsupport/src/main/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract.java Mon Apr 25 09:53:10 2011
@@ -15,65 +15,64 @@ import org.junit.Test;
  * Contract test for value types ({@link #equals(Object)} and {@link #hashCode()}).
  */
 public abstract class ValueTypeContractTestAbstract<T> {
-	
-	@Before
-	public void setUp() throws Exception {
-		assertSizeAtLeast(getObjectsWithSameValue(), 2);
-		assertSizeAtLeast(getObjectsWithDifferentValue(), 1);
-	}
-
-	private void assertSizeAtLeast(List<T> objects, int i) {
-		assertThat(objects, is(notNullValue()));
-		assertThat(objects.size(), is(greaterThan(i-1)));
-	}
-	
-	
-	@Test
-	public void notEqualToNull() throws Exception {
-		for(T o1: getObjectsWithSameValue()) {
-			assertThat(o1.equals(null), is(false));
-		}
-		for(T o1: getObjectsWithDifferentValue()) {
-			assertThat(o1.equals(null), is(false));
-		}
-	}
-
-	@Test
-	public void reflexiveAndSymmetric() throws Exception {
-		for(T o1: getObjectsWithSameValue()) {
-			for(T o2: getObjectsWithSameValue()) {
-				assertThat(o1.equals(o2), is(true));
-				assertThat(o2.equals(o1), is(true));
-				assertThat(o1.hashCode(), is(equalTo(o2.hashCode())));
-			}
-		}
-	}
-
-	@Test
-	public void notEqual() throws Exception {
-		for(T o1: getObjectsWithSameValue()) {
-			for(T o2: getObjectsWithDifferentValue()) {
-				assertThat(o1.equals(o2), is(false));
-				assertThat(o2.equals(o1), is(false));
-			}
-		}
-	}
-
-	@Test
-	public void transitiveWhenEqual() throws Exception {
-		for(T o1: getObjectsWithSameValue()) {
-			for(T o2: getObjectsWithSameValue()) {
-				for(Object o3: getObjectsWithSameValue()) {
-					assertThat(o1.equals(o2), is(true));
-					assertThat(o2.equals(o3), is(true));
-					assertThat(o1.equals(o3), is(true));
-				}
-			}
-		}
-	}
 
-	protected abstract List<T> getObjectsWithSameValue();
-	protected abstract List<T> getObjectsWithDifferentValue();
+    @Before
+    public void setUp() throws Exception {
+        assertSizeAtLeast(getObjectsWithSameValue(), 2);
+        assertSizeAtLeast(getObjectsWithDifferentValue(), 1);
+    }
+
+    private void assertSizeAtLeast(final List<T> objects, final int i) {
+        assertThat(objects, is(notNullValue()));
+        assertThat(objects.size(), is(greaterThan(i - 1)));
+    }
+
+    @Test
+    public void notEqualToNull() throws Exception {
+        for (final T o1 : getObjectsWithSameValue()) {
+            assertThat(o1.equals(null), is(false));
+        }
+        for (final T o1 : getObjectsWithDifferentValue()) {
+            assertThat(o1.equals(null), is(false));
+        }
+    }
+
+    @Test
+    public void reflexiveAndSymmetric() throws Exception {
+        for (final T o1 : getObjectsWithSameValue()) {
+            for (final T o2 : getObjectsWithSameValue()) {
+                assertThat(o1.equals(o2), is(true));
+                assertThat(o2.equals(o1), is(true));
+                assertThat(o1.hashCode(), is(equalTo(o2.hashCode())));
+            }
+        }
+    }
+
+    @Test
+    public void notEqual() throws Exception {
+        for (final T o1 : getObjectsWithSameValue()) {
+            for (final T o2 : getObjectsWithDifferentValue()) {
+                assertThat(o1.equals(o2), is(false));
+                assertThat(o2.equals(o1), is(false));
+            }
+        }
+    }
+
+    @Test
+    public void transitiveWhenEqual() throws Exception {
+        for (final T o1 : getObjectsWithSameValue()) {
+            for (final T o2 : getObjectsWithSameValue()) {
+                for (final Object o3 : getObjectsWithSameValue()) {
+                    assertThat(o1.equals(o2), is(true));
+                    assertThat(o2.equals(o3), is(true));
+                    assertThat(o1.equals(o3), is(true));
+                }
+            }
+        }
+    }
 
+    protected abstract List<T> getObjectsWithSameValue();
+
+    protected abstract List<T> getObjectsWithDifferentValue();
 
 }

Modified: incubator/isis/trunk/core/testsupport/src/test/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract_BigIntegerTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/test/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract_BigIntegerTest.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/test/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract_BigIntegerTest.java (original)
+++ incubator/isis/trunk/core/testsupport/src/test/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract_BigIntegerTest.java Mon Apr 25 09:53:10 2011
@@ -4,18 +4,16 @@ import java.math.BigInteger;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.isis.core.testsupport.value.ValueTypeContractTestAbstract;
-
 public class ValueTypeContractTestAbstract_BigIntegerTest extends ValueTypeContractTestAbstract<BigInteger> {
 
-	@Override
-	protected List<BigInteger> getObjectsWithSameValue() {
-		return Arrays.asList(new BigInteger("1"), new BigInteger("1"));
-	}
+    @Override
+    protected List<BigInteger> getObjectsWithSameValue() {
+        return Arrays.asList(new BigInteger("1"), new BigInteger("1"));
+    }
 
-	@Override
-	protected List<BigInteger> getObjectsWithDifferentValue() {
-		return Arrays.asList(new BigInteger("2"));
-	}
+    @Override
+    protected List<BigInteger> getObjectsWithDifferentValue() {
+        return Arrays.asList(new BigInteger("2"));
+    }
 
 }

Modified: incubator/isis/trunk/core/testsupport/src/test/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract_StringTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/testsupport/src/test/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract_StringTest.java?rev=1096446&r1=1096445&r2=1096446&view=diff
==============================================================================
--- incubator/isis/trunk/core/testsupport/src/test/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract_StringTest.java (original)
+++ incubator/isis/trunk/core/testsupport/src/test/java/org/apache/isis/core/testsupport/value/ValueTypeContractTestAbstract_StringTest.java Mon Apr 25 09:53:10 2011
@@ -3,18 +3,16 @@ package org.apache.isis.core.testsupport
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.isis.core.testsupport.value.ValueTypeContractTestAbstract;
-
 public class ValueTypeContractTestAbstract_StringTest extends ValueTypeContractTestAbstract<String> {
 
-	@Override
-	protected List<String> getObjectsWithSameValue() {
-		return Arrays.asList(new String("1"), new String("1"));
-	}
+    @Override
+    protected List<String> getObjectsWithSameValue() {
+        return Arrays.asList(new String("1"), new String("1"));
+    }
 
-	@Override
-	protected List<String> getObjectsWithDifferentValue() {
-		return Arrays.asList(new String("1 "), new String(" 1"), new String("2"));
-	}
+    @Override
+    protected List<String> getObjectsWithDifferentValue() {
+        return Arrays.asList(new String("1 "), new String(" 1"), new String("2"));
+    }
 
 }



Mime
View raw message