incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1098945 [24/25] - in /incubator/isis/trunk/viewer: bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/ bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/components/ bdd/common/src/main/java/org/apache/isis/viewer/bdd/commo...
Date Tue, 03 May 2011 07:18:38 GMT
Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/MultilineTextFieldContentTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/MultilineTextFieldContentTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/MultilineTextFieldContentTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/MultilineTextFieldContentTest.java Tue May  3 07:18:19 2011
@@ -17,23 +17,11 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.view.text;
 
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.integration.junit4.JMock;
-import org.jmock.integration.junit4.JUnit4Mockery;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 import org.apache.isis.core.commons.config.IsisConfigurationDefault;
 import org.apache.isis.core.metamodel.spec.SpecificationLoader;
 import org.apache.isis.core.runtime.authentication.AuthenticationManager;
@@ -44,40 +32,44 @@ import org.apache.isis.runtimes.dflt.run
 import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContextStatic;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.runtimes.dflt.runtime.system.session.IsisSessionFactoryDefault;
-import org.apache.isis.viewer.dnd.view.text.CursorPosition;
-import org.apache.isis.viewer.dnd.view.text.TextBlockTarget;
-import org.apache.isis.viewer.dnd.view.text.TextContent;
-import org.apache.isis.viewer.dnd.view.text.TextSelection;
-
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JMock;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 @RunWith(JMock.class)
 public class MultilineTextFieldContentTest {
 
     private TextContent content;
-    private Mockery mockery = new JUnit4Mockery();
+    private final Mockery mockery = new JUnit4Mockery();
     protected TemplateImageLoader mockTemplateImageLoader;
     protected SpecificationLoader mockSpecificationLoader;
     protected PersistenceSessionFactory mockPersistenceSessionFactory;
     private UserProfileLoader mockUserProfileLoader;
     protected AuthenticationManager mockAuthenticationManager;
     protected AuthorizationManager mockAuthorizationManager;
-    
-	private List<Object> servicesList;
 
-    
+    private List<Object> servicesList;
+
     @Before
     public void setUp() throws Exception {
         Logger.getRootLogger().setLevel(Level.OFF);
 
         servicesList = Collections.emptyList();
-        
+
         mockTemplateImageLoader = mockery.mock(TemplateImageLoader.class);
         mockSpecificationLoader = mockery.mock(SpecificationLoader.class);
         mockPersistenceSessionFactory = mockery.mock(PersistenceSessionFactory.class);
         mockUserProfileLoader = mockery.mock(UserProfileLoader.class);
         mockAuthenticationManager = mockery.mock(AuthenticationManager.class);
         mockAuthorizationManager = mockery.mock(AuthorizationManager.class);
-        
+
         mockery.checking(new Expectations() {
             {
                 ignoring(mockTemplateImageLoader);
@@ -89,18 +81,13 @@ public class MultilineTextFieldContentTe
             }
         });
 
-        IsisSessionFactoryDefault sessionFactory = new IsisSessionFactoryDefault(
-                DeploymentType.EXPLORATION, 
-                new IsisConfigurationDefault(), 
-                mockTemplateImageLoader, 
-                mockSpecificationLoader, 
-                mockAuthenticationManager, 
-		        mockAuthorizationManager,
-                mockUserProfileLoader, 
-                mockPersistenceSessionFactory, servicesList);
+        final IsisSessionFactoryDefault sessionFactory =
+            new IsisSessionFactoryDefault(DeploymentType.EXPLORATION, new IsisConfigurationDefault(),
+                mockTemplateImageLoader, mockSpecificationLoader, mockAuthenticationManager, mockAuthorizationManager,
+                mockUserProfileLoader, mockPersistenceSessionFactory, servicesList);
         IsisContextStatic.createRelaxedInstance(sessionFactory);
         sessionFactory.init();
-                
+
         final TextBlockTarget target = new TextBlockTargetExample();
 
         content = new TextContent(target, 4, TextContent.WRAPPING);
@@ -113,7 +100,8 @@ public class MultilineTextFieldContentTe
         selection.resetTo(new CursorPosition(content, 1, 3));
         selection.extendTo(new CursorPosition(content, 1, 7));
         content.delete(selection);
-        Assert.assertEquals("Line one\nLino\nLine three\nLine four that is long enough that it wraps", content.getText());
+        Assert.assertEquals("Line one\nLino\nLine three\nLine four that is long enough that it wraps",
+            content.getText());
     }
 
     @Test
@@ -122,7 +110,8 @@ public class MultilineTextFieldContentTe
         selection.resetTo(new CursorPosition(content, 1, 7));
         selection.extendTo(new CursorPosition(content, 1, 3));
         content.delete(selection);
-        Assert.assertEquals("Line one\nLino\nLine three\nLine four that is long enough that it wraps", content.getText());
+        Assert.assertEquals("Line one\nLino\nLine three\nLine four that is long enough that it wraps",
+            content.getText());
     }
 
     @Test
@@ -158,7 +147,8 @@ public class MultilineTextFieldContentTe
         selection.resetTo(new CursorPosition(content, 5, 0));
         selection.extendTo(new CursorPosition(content, 5, 3));
         content.delete(selection);
-        Assert.assertEquals("Line one\nLine two\nLine three\nLine four that is long enough that wraps", content.getText());
+        Assert.assertEquals("Line one\nLine two\nLine three\nLine four that is long enough that wraps",
+            content.getText());
     }
 
     @Test

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextBlockTargetExample.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextBlockTargetExample.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextBlockTargetExample.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextBlockTargetExample.java Tue May  3 07:18:19 2011
@@ -17,65 +17,74 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.view.text;
 
 import org.apache.isis.viewer.dnd.drawing.Text;
-import org.apache.isis.viewer.dnd.view.text.TextBlockTarget;
-
 
 final class TextBlockTargetExample implements TextBlockTarget {
+    @Override
     public int getMaxFieldWidth() {
         return 200;
     }
 
+    @Override
     public Text getText() {
         return new Text() {
 
+            @Override
             public int charWidth(final char ch) {
                 return 10;
             }
 
+            @Override
             public int stringHeight(final String text, final int width) {
                 return 0;
             }
 
+            @Override
             public int stringWidth(final String string) {
                 return 40;
             }
 
+            @Override
             public int stringWidth(final String message, final int maxWidth) {
                 return 0;
             }
 
+            @Override
             public int getAscent() {
                 return 10;
             }
 
+            @Override
             public int getLineHeight() {
                 return 15;
             }
 
+            @Override
             public int getMidPoint() {
                 return 7;
             }
 
+            @Override
             public int getDescent() {
                 return 0;
             }
 
+            @Override
             public int getTextHeight() {
                 return 15;
             }
 
+            @Override
             public int getLineSpacing() {
                 return 0;
             }
 
+            @Override
             public String getName() {
                 return null;
             }
         };
     }
 }
-

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextBlockTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextBlockTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextBlockTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextBlockTest.java Tue May  3 07:18:19 2011
@@ -17,16 +17,12 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.view.text;
 
 import junit.framework.TestCase;
 
 import org.apache.log4j.Level;
 import org.apache.log4j.LogManager;
-import org.apache.isis.viewer.dnd.view.text.TextBlock;
-import org.apache.isis.viewer.dnd.view.text.TextBlockTarget;
-
 
 public class TextBlockTest extends TestCase {
 
@@ -41,7 +37,8 @@ public class TextBlockTest extends TestC
         LogManager.getRootLogger().setLevel(Level.OFF);
 
         final TextBlockTarget user = new TextBlockTargetExample();
-        block = new TextBlock(user, "Now is the winter of our discontent made summer by this glorious sun of York", true);
+        block =
+            new TextBlock(user, "Now is the winter of our discontent made summer by this glorious sun of York", true);
         // "Now is the winter "
         // "of our discontent "
         // "made summer by "
@@ -62,7 +59,8 @@ public class TextBlockTest extends TestC
         try {
             block.insert(0, 4, "\n");
             fail();
-        } catch (final IllegalArgumentException expected) {}
+        } catch (final IllegalArgumentException expected) {
+        }
     }
 
     public void testCountLine() {

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextFieldContentStub.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextFieldContentStub.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextFieldContentStub.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextFieldContentStub.java Tue May  3 07:18:19 2011
@@ -17,10 +17,8 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.view.text;
 
-import org.apache.isis.viewer.dnd.view.text.TextContent;
 
 public class TextFieldContentStub extends TextContent {
 
@@ -29,7 +27,8 @@ public class TextFieldContentStub extend
     }
 
     @Override
-    public void alignDisplay(final int line) {}
+    public void alignDisplay(final int line) {
+    }
 
     @Override
     public int getNoLinesOfContent() {

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextFieldContentTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextFieldContentTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextFieldContentTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextFieldContentTest.java Tue May  3 07:18:19 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.view.text;
 
 import static org.junit.Assert.assertEquals;
@@ -25,17 +24,6 @@ import static org.junit.Assert.assertEqu
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.integration.junit4.JMock;
-import org.jmock.integration.junit4.JUnit4Mockery;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 import org.apache.isis.core.commons.config.IsisConfigurationDefault;
 import org.apache.isis.core.metamodel.spec.SpecificationLoader;
 import org.apache.isis.core.runtime.authentication.AuthenticationManager;
@@ -49,18 +37,24 @@ import org.apache.isis.runtimes.dflt.run
 import org.apache.isis.runtimes.dflt.runtime.system.session.IsisSessionFactory;
 import org.apache.isis.runtimes.dflt.runtime.system.session.IsisSessionFactoryDefault;
 import org.apache.isis.viewer.dnd.drawing.Location;
-import org.apache.isis.viewer.dnd.view.text.CursorPosition;
-import org.apache.isis.viewer.dnd.view.text.TextBlockTarget;
-import org.apache.isis.viewer.dnd.view.text.TextContent;
-
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JMock;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 @RunWith(JMock.class)
 public class TextFieldContentTest {
 
     private TextContent content;
 
-    private Mockery mockery = new JUnit4Mockery();
-    
+    private final Mockery mockery = new JUnit4Mockery();
+
     protected TemplateImageLoader mockTemplateImageLoader;
     protected SpecificationLoader mockSpecificationLoader;
     private UserProfileLoader mockUserProfileLoader;
@@ -69,9 +63,7 @@ public class TextFieldContentTest {
     protected AuthenticationManager mockAuthenticationManager;
     protected AuthorizationManager mockAuthorizationManager;
 
-	private List<Object> servicesList;
-
-
+    private List<Object> servicesList;
 
     @Before
     public void setUp() throws Exception {
@@ -86,7 +78,7 @@ public class TextFieldContentTest {
         mockPersistenceSession = mockery.mock(PersistenceSession.class);
         mockAuthenticationManager = mockery.mock(AuthenticationManager.class);
         mockAuthorizationManager = mockery.mock(AuthorizationManager.class);
-        
+
         mockery.checking(new Expectations() {
             {
                 ignoring(mockTemplateImageLoader);
@@ -98,16 +90,10 @@ public class TextFieldContentTest {
             }
         });
 
-        IsisSessionFactory sessionFactory = 
-            new IsisSessionFactoryDefault(
-                    DeploymentType.EXPLORATION, 
-                    new IsisConfigurationDefault(), 
-                    mockTemplateImageLoader, 
-                    mockSpecificationLoader, 
-                    mockAuthenticationManager, 
-    		        mockAuthorizationManager,
-                    mockUserProfileLoader, 
-                    mockPersistenceSessionFactory, servicesList);
+        final IsisSessionFactory sessionFactory =
+            new IsisSessionFactoryDefault(DeploymentType.EXPLORATION, new IsisConfigurationDefault(),
+                mockTemplateImageLoader, mockSpecificationLoader, mockAuthenticationManager, mockAuthorizationManager,
+                mockUserProfileLoader, mockPersistenceSessionFactory, servicesList);
         sessionFactory.init();
         IsisContextStatic.createRelaxedInstance(sessionFactory);
 
@@ -149,9 +135,9 @@ public class TextFieldContentTest {
 
     @Test
     public void testInsert() {
-    /*
-     * CursorPosition cursor = new CursorPosition(0,0); content.insert(cursor, "test string");
-     */
+        /*
+         * CursorPosition cursor = new CursorPosition(0,0); content.insert(cursor, "test string");
+         */
     }
 
     @Test
@@ -175,11 +161,12 @@ public class TextFieldContentTest {
     }
 
     @Test
-    @Ignore // TODO reinstate once name has be set
+    @Ignore
+    // TODO reinstate once name has be set
     public void testAlignField() {
         // the following text wraps so it takes up 9 line
         content
-                .setText("Apache Isis - a framework that exposes behaviourally complete business objects directly to the user. Copyright (C) 2010 Apache Software Foundation");
+            .setText("Apache Isis - a framework that exposes behaviourally complete business objects directly to the user. Copyright (C) 2010 Apache Software Foundation");
 
         assertEquals(9, content.getNoLinesOfContent());
 
@@ -215,10 +202,11 @@ public class TextFieldContentTest {
     @Test
     public void testInstertOverTheEndOfLine() {
         final CursorPosition cursor = new CursorPosition(content, 0, 0);
-        content.insert(cursor, "test insert that is longer than the four lines that were originally allocated for this test");
+        content.insert(cursor,
+            "test insert that is longer than the four lines that were originally allocated for this test");
 
-        assertEquals("test insert that is longer than the four lines that were originally allocated for this test", content
-                .getText());
+        assertEquals("test insert that is longer than the four lines that were originally allocated for this test",
+            content.getText());
         assertEquals(4, content.getNoDisplayLines());
         assertEquals(6, content.getNoLinesOfContent());
     }

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextUtilsTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextUtilsTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/view/text/TextUtilsTest.java Tue May  3 07:18:19 2011
@@ -17,16 +17,13 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.view.text;
 
 import junit.framework.TestCase;
 
 import org.apache.isis.viewer.dnd.drawing.Text;
-import org.apache.isis.viewer.dnd.view.text.TextUtils;
 import org.apache.isis.viewer.dnd.viewer.drawing.DummyText;
 
-
 public class TextUtilsTest extends TestCase {
 
     public void testDrawingTextTruncated() {
@@ -60,7 +57,6 @@ public class TextUtilsTest extends TestC
         assertEquals("test string...", TextUtils.limitText(title, style, 199));
     }
 
-
     public void testNoSpace() {
         final String title = "test string, that? is truncated";
         final Text style = new DummyText();
@@ -69,4 +65,3 @@ public class TextUtilsTest extends TestC
     }
 
 }
-

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/ViewUpdateNotifierTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/ViewUpdateNotifierTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/ViewUpdateNotifierTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/ViewUpdateNotifierTest.java Tue May  3 07:18:19 2011
@@ -17,26 +17,18 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.viewer;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
 import java.util.Collections;
 import java.util.List;
 import java.util.Vector;
 
 import junit.framework.Assert;
 
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.integration.junit4.JMock;
-import org.jmock.integration.junit4.JUnit4Mockery;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.config.IsisConfigurationDefault;
 import org.apache.isis.core.commons.debug.DebugString;
@@ -66,19 +58,25 @@ import org.apache.isis.viewer.dnd.DummyW
 import org.apache.isis.viewer.dnd.view.View;
 import org.apache.isis.viewer.dnd.view.base.ViewUpdateNotifierImpl;
 import org.apache.isis.viewer.dnd.view.content.RootObject;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JMock;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 @RunWith(JMock.class)
 public class ViewUpdateNotifierTest {
 
-    private Mockery mockery = new JUnit4Mockery();
-    
+    private final Mockery mockery = new JUnit4Mockery();
+
     private ExposedViewUpdateNotifier notifier;
     private TestProxyAdapter object;
-    
+
     protected TemplateImageLoader mockTemplateImageLoader;
     protected SpecificationLoader mockSpecificationLoader;
     private UserProfileLoader mockUserProfileLoader;
@@ -89,9 +87,7 @@ public class ViewUpdateNotifierTest {
     protected AuthenticationManager mockAuthenticationManager;
     protected AuthorizationManager mockAuthorizationManager;
 
-	private List<Object> servicesList;
-
-
+    private List<Object> servicesList;
 
     @Before
     public void setUp() throws Exception {
@@ -108,47 +104,43 @@ public class ViewUpdateNotifierTest {
         mockTransaction = mockery.mock(IsisTransaction.class);
         mockAuthenticationManager = mockery.mock(AuthenticationManager.class);
         mockAuthorizationManager = mockery.mock(AuthorizationManager.class);
-        
-        mockery.checking(new Expectations() {{
-            ignoring(mockTemplateImageLoader);
-            ignoring(mockSpecificationLoader);
-            ignoring(mockAuthenticationManager);
-            ignoring(mockAuthorizationManager);
-
-            one(mockUserProfileLoader).getProfile(with(any(AuthenticationSession.class)));
-            will(returnValue(new UserProfile()));
-            
-            ignoring(mockUserProfileLoader);
-
-            allowing(mockPersistenceSessionFactory).createPersistenceSession();
-            will(returnValue(mockPersistenceSession));
-
-            ignoring(mockPersistenceSessionFactory);
-            
-            allowing(mockPersistenceSession).getTransactionManager();
-            will(returnValue(mockTransactionManager));
-
-            ignoring(mockPersistenceSession);
-
-            allowing(mockTransactionManager).getTransaction();
-            will(returnValue(mockTransaction));
-            
-            ignoring(mockTransaction);
-        }});
-
-        IsisSessionFactory sessionFactory = 
-            new IsisSessionFactoryDefault(
-                    DeploymentType.EXPLORATION, 
-                    new IsisConfigurationDefault(), 
-                    mockTemplateImageLoader, 
-                    mockSpecificationLoader, 
-                    mockAuthenticationManager, 
-    		        mockAuthorizationManager,
-                    mockUserProfileLoader, 
-                    mockPersistenceSessionFactory, servicesList);
+
+        mockery.checking(new Expectations() {
+            {
+                ignoring(mockTemplateImageLoader);
+                ignoring(mockSpecificationLoader);
+                ignoring(mockAuthenticationManager);
+                ignoring(mockAuthorizationManager);
+
+                one(mockUserProfileLoader).getProfile(with(any(AuthenticationSession.class)));
+                will(returnValue(new UserProfile()));
+
+                ignoring(mockUserProfileLoader);
+
+                allowing(mockPersistenceSessionFactory).createPersistenceSession();
+                will(returnValue(mockPersistenceSession));
+
+                ignoring(mockPersistenceSessionFactory);
+
+                allowing(mockPersistenceSession).getTransactionManager();
+                will(returnValue(mockTransactionManager));
+
+                ignoring(mockPersistenceSession);
+
+                allowing(mockTransactionManager).getTransaction();
+                will(returnValue(mockTransaction));
+
+                ignoring(mockTransaction);
+            }
+        });
+
+        final IsisSessionFactory sessionFactory =
+            new IsisSessionFactoryDefault(DeploymentType.EXPLORATION, new IsisConfigurationDefault(),
+                mockTemplateImageLoader, mockSpecificationLoader, mockAuthenticationManager, mockAuthorizationManager,
+                mockUserProfileLoader, mockPersistenceSessionFactory, servicesList);
         sessionFactory.init();
         IsisContextStatic.createRelaxedInstance(sessionFactory);
-        
+
         IsisContext.openSession(new ExplorationSession());
 
         notifier = new ExposedViewUpdateNotifier();
@@ -160,7 +152,7 @@ public class ViewUpdateNotifierTest {
     public void tearDown() {
         IsisContext.closeSession();
     }
-    
+
     private DummyView createView(final ObjectAdapter object) {
         final DummyView view = new DummyView();
         view.setupContent(new RootObject(object));
@@ -192,7 +184,8 @@ public class ViewUpdateNotifierTest {
         try {
             notifier.add(view);
             fail();
-        } catch (final IsisException expected) {}
+        } catch (final IsisException expected) {
+        }
     }
 
     @Test
@@ -217,11 +210,10 @@ public class ViewUpdateNotifierTest {
     @Test
     public void testViewDirty() {
         // nasty ... need to tidy up the setup
-        TestProxySystem testProxySystem = new TestProxySystem();
+        final TestProxySystem testProxySystem = new TestProxySystem();
         testProxySystem.init();
-        
-        object.setupResolveState(ResolveState.RESOLVED);
 
+        object.setupResolveState(ResolveState.RESOLVED);
 
         final Vector vector = new Vector();
         final DummyView view1 = createView(object);
@@ -238,7 +230,7 @@ public class ViewUpdateNotifierTest {
 
         IsisContext.getUpdateNotifier().addChangedObject(object);
         notifier.invalidateViewsForChangedObjects();
-        
+
         assertEquals(1, view1.invalidateContent);
         assertEquals(1, view2.invalidateContent);
     }
@@ -246,9 +238,9 @@ public class ViewUpdateNotifierTest {
     @Test
     public void testDisposedViewsRemoved() {
         // nasty ... need to tidy up the setup
-        TestProxySystem testProxySystem = new TestProxySystem();
+        final TestProxySystem testProxySystem = new TestProxySystem();
         testProxySystem.init();
-        
+
         final DummyWorkspaceView workspace = new DummyWorkspaceView();
 
         final Vector vector = new Vector();
@@ -271,7 +263,7 @@ public class ViewUpdateNotifierTest {
         IsisContext.getUpdateNotifier().addDisposedObject(object);
         notifier.removeViewsForDisposedObjects();
         assertEquals(0, workspace.getSubviews().length);
-        
+
     }
 }
 
@@ -279,7 +271,7 @@ class ExposedViewUpdateNotifier extends 
 
     public void assertContainsViewForObject(final View view, final ObjectAdapter object) {
         Assert.assertTrue(viewListByAdapter.containsKey(object));
-        final Vector viewsForObject = (Vector) viewListByAdapter.get(object);
+        final Vector viewsForObject = viewListByAdapter.get(object);
         Assert.assertTrue(viewsForObject.contains(view));
     }
 

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/ActionFieldBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/ActionFieldBuilderTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/ActionFieldBuilderTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/ActionFieldBuilderTest.java Tue May  3 07:18:19 2011
@@ -17,24 +17,11 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.viewer.basic;
 
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.easymock.MockControl;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.integration.junit4.JMock;
-import org.jmock.integration.junit4.JUnit4Mockery;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.commons.config.IsisConfigurationDefault;
@@ -56,14 +43,24 @@ import org.apache.isis.viewer.dnd.view.A
 import org.apache.isis.viewer.dnd.view.Content;
 import org.apache.isis.viewer.dnd.view.View;
 import org.apache.isis.viewer.dnd.view.ViewFactory;
-
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.easymock.MockControl;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JMock;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 @RunWith(JMock.class)
 public class ActionFieldBuilderTest {
     private ActionFieldBuilder builder;
 
-    private Mockery mockery = new JUnit4Mockery();
-    
+    private final Mockery mockery = new JUnit4Mockery();
+
     private IsisConfiguration configuration;
     private List<Object> servicesList;
     protected TemplateImageLoader mockTemplateImageLoader;
@@ -72,7 +69,6 @@ public class ActionFieldBuilderTest {
     private UserProfileLoader mockUserProfileLoader;
     protected AuthenticationManager mockAuthenticationManager;
     protected AuthorizationManager mockAuthorizationManager;
-    
 
     @Before
     public void setUp() throws Exception {
@@ -80,47 +76,44 @@ public class ActionFieldBuilderTest {
 
         configuration = new IsisConfigurationDefault();
         servicesList = Collections.emptyList();
-        
+
         mockTemplateImageLoader = mockery.mock(TemplateImageLoader.class);
         mockSpecificationLoader = mockery.mock(SpecificationLoader.class);
         mockPersistenceSessionFactory = mockery.mock(PersistenceSessionFactory.class);
         mockUserProfileLoader = mockery.mock(UserProfileLoader.class);
         mockAuthenticationManager = mockery.mock(AuthenticationManager.class);
         mockAuthorizationManager = mockery.mock(AuthorizationManager.class);
-        
-        mockery.checking(new Expectations(){{
-            ignoring(mockSpecificationLoader);
-            ignoring(mockPersistenceSessionFactory);
-            
-            one(mockUserProfileLoader).getProfile(with(any(AuthenticationSession.class)));
-            will(returnValue(new UserProfile()));
-
-            ignoring(mockTemplateImageLoader);
-            ignoring(mockAuthenticationManager);
-            ignoring(mockAuthorizationManager);
-        }});
-        
+
+        mockery.checking(new Expectations() {
+            {
+                ignoring(mockSpecificationLoader);
+                ignoring(mockPersistenceSessionFactory);
+
+                one(mockUserProfileLoader).getProfile(with(any(AuthenticationSession.class)));
+                will(returnValue(new UserProfile()));
+
+                ignoring(mockTemplateImageLoader);
+                ignoring(mockAuthenticationManager);
+                ignoring(mockAuthorizationManager);
+            }
+        });
+
         final ViewFactory subviewSpec = new ViewFactory() {
-            public View createView(final Content content, Axes axes, int fieldNumber) {
+            @Override
+            public View createView(final Content content, final Axes axes, final int fieldNumber) {
                 return new DummyView();
             }
         };
 
+        final IsisSessionFactoryDefault sessionFactory =
+            new IsisSessionFactoryDefault(DeploymentType.EXPLORATION, configuration, mockTemplateImageLoader,
+                mockSpecificationLoader, mockAuthenticationManager, mockAuthorizationManager, mockUserProfileLoader,
+                mockPersistenceSessionFactory, servicesList);
 
-		final IsisSessionFactoryDefault sessionFactory = new IsisSessionFactoryDefault(
-		        DeploymentType.EXPLORATION, 
-		        configuration, 
-		        mockTemplateImageLoader, 
-		        mockSpecificationLoader, 
-		        mockAuthenticationManager, 
-		        mockAuthorizationManager,
-		        mockUserProfileLoader, 
-		        mockPersistenceSessionFactory, servicesList);
-        
         IsisContext.setConfiguration(sessionFactory.getConfiguration());
-		IsisContextStatic.createRelaxedInstance(sessionFactory);
+        IsisContextStatic.createRelaxedInstance(sessionFactory);
         IsisContextStatic.openSession(new ExplorationSession());
-        
+
         builder = new ActionFieldBuilder(subviewSpec);
 
     }
@@ -151,18 +144,17 @@ public class ActionFieldBuilderTest {
     }
 
     /*
-     * // TODO fails on server as cant load X11 for Text class public void xxxtestNewBuild() {
-     * view.setupSubviews(new View[0]);
+     * // TODO fails on server as cant load X11 for Text class public void xxxtestNewBuild() { view.setupSubviews(new
+     * View[0]);
      * 
      * view.addAction("add TextView0 null"); view.addAction("add MockView1/LabelBorder"); view.addAction("add
      * MockView2/LabelBorder");
      * 
      * builder.build(view);
      * 
-     * view.verify(); } public void xxxtestUpdateBuildWhereParameterHasChangedFromNullToAnObject() {
-     * DummyView[] views = new DummyView[2]; views[1] = new DummyView(); ObjectParameter objectParameter = new
-     * ObjectParameter("name", null, null, false, 1, actionContent); views[1].setupContent(objectParameter);
-     * view.setupSubviews(views);
+     * view.verify(); } public void xxxtestUpdateBuildWhereParameterHasChangedFromNullToAnObject() { DummyView[] views =
+     * new DummyView[2]; views[1] = new DummyView(); ObjectParameter objectParameter = new ObjectParameter("name", null,
+     * null, false, 1, actionContent); views[1].setupContent(objectParameter); view.setupSubviews(views);
      * 
      * actionContent.setParameter(0, new DummyObjectAdapter());
      * 
@@ -173,8 +165,8 @@ public class ActionFieldBuilderTest {
      * view.verify(); }
      * 
      * public void xxxtestUpdateBuildWhereParameterHasChangedFromAnObjectToNull() { DummyView[] views = new
-     * DummyView[2]; views[1] = new DummyView(); ObjectParameter objectParameter = new ObjectParameter("name",
-     * new DummyObjectAdapter(), null, false, 1, actionContent); views[1].setupContent(objectParameter);
+     * DummyView[2]; views[1] = new DummyView(); ObjectParameter objectParameter = new ObjectParameter("name", new
+     * DummyObjectAdapter(), null, false, 1, actionContent); views[1].setupContent(objectParameter);
      * view.setupSubviews(views);
      * 
      * objectParameter.setObject(null);
@@ -185,10 +177,10 @@ public class ActionFieldBuilderTest {
      * 
      * view.verify(); }
      * 
-     * public void xxxtestUpdateBuildWhereParameterHasChangedFromOneObjectToAnother() { DummyView[] views =
-     * new DummyView[2]; views[1] = new DummyView(); ObjectParameter objectParameter = new
-     * ObjectParameter("name", new DummyObjectAdapter(), null, false, 1, actionContent);
-     * views[1].setupContent(objectParameter); view.setupSubviews(views);
+     * public void xxxtestUpdateBuildWhereParameterHasChangedFromOneObjectToAnother() { DummyView[] views = new
+     * DummyView[2]; views[1] = new DummyView(); ObjectParameter objectParameter = new ObjectParameter("name", new
+     * DummyObjectAdapter(), null, false, 1, actionContent); views[1].setupContent(objectParameter);
+     * view.setupSubviews(views);
      * 
      * objectParameter.setObject(new DummyObjectAdapter());
      * 
@@ -198,10 +190,10 @@ public class ActionFieldBuilderTest {
      * 
      * view.verify(); }
      * 
-     * public void xxtestUpdateBuildWhereParameterObjectSetButToSameObject() { DummyView[] views = new
-     * DummyView[2]; views[1] = new DummyView(); DummyObjectAdapter dummyObjectAdapter = new DummyObjectAdapter();
-     * ObjectParameter objectParameter = new ObjectParameter("name", dummyObjectAdapter, null, false, 1,
-     * actionContent); views[1].setupContent(objectParameter); view.setupSubviews(views);
+     * public void xxtestUpdateBuildWhereParameterObjectSetButToSameObject() { DummyView[] views = new DummyView[2];
+     * views[1] = new DummyView(); DummyObjectAdapter dummyObjectAdapter = new DummyObjectAdapter(); ObjectParameter
+     * objectParameter = new ObjectParameter("name", dummyObjectAdapter, null, false, 1, actionContent);
+     * views[1].setupContent(objectParameter); view.setupSubviews(views);
      * 
      * actionContent.setParameter(0, dummyObjectAdapter); // objectParameter.setObject(dummyObjectAdapter);
      * 
@@ -212,7 +204,7 @@ public class ActionFieldBuilderTest {
      * class MockActionHelper extends ActionHelper {
      * 
      * protected MockActionHelper( ObjectAdapter target, Action action, String[] labels, ObjectAdapter[] parameters,
-     * ObjectSpecification[] parameterTypes, boolean[] required) { super(target, action, labels,
-     * parameters, parameterTypes, required); }
+     * ObjectSpecification[] parameterTypes, boolean[] required) { super(target, action, labels, parameters,
+     * parameterTypes, required); }
      */
 }

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/NullColor.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/NullColor.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/NullColor.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/NullColor.java Tue May  3 07:18:19 2011
@@ -17,24 +17,24 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.viewer.basic;
 
 import org.apache.isis.viewer.dnd.drawing.Color;
 
-
 public class NullColor implements Color {
 
+    @Override
     public Color brighter() {
         return null;
     }
 
+    @Override
     public Color darker() {
         return null;
     }
 
+    @Override
     public String getName() {
         return null;
     }
 }
-

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/PlacementStrategyImplTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/PlacementStrategyImplTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/PlacementStrategyImplTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/PlacementStrategyImplTest.java Tue May  3 07:18:19 2011
@@ -17,12 +17,8 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.viewer.basic;
 
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
 import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
 import org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyConfiguration;
 import org.apache.isis.viewer.dnd.DummyView;
@@ -30,7 +26,9 @@ import org.apache.isis.viewer.dnd.DummyW
 import org.apache.isis.viewer.dnd.drawing.Location;
 import org.apache.isis.viewer.dnd.drawing.Size;
 import org.apache.isis.viewer.dnd.view.PlacementStrategyImpl;
-
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
 public class PlacementStrategyImplTest {
 
@@ -69,34 +67,35 @@ public class PlacementStrategyImplTest {
 
     @Test
     public void defaultWhenNoRelativeView() throws Exception {
-        Location location = strategy.determinePlacement(workspace, null, newView);
+        final Location location = strategy.determinePlacement(workspace, null, newView);
         Assert.assertEquals(new Location(), location);
     }
 
     @Test
     public void placeToRight() throws Exception {
-        Location location = strategy.determinePlacement(workspace, existingView, newView);
+        final Location location = strategy.determinePlacement(workspace, existingView, newView);
         Assert.assertEquals(new Location(ORIGINAL_X + ROOT_VIEW_WIDTH + PADDING, 70), location);
     }
 
     @Test
     public void adjustWhenOnTopOfExistingField() throws Exception {
-        DummyView anotherView = new DummyView();
+        final DummyView anotherView = new DummyView();
         anotherView.setLocation(new Location(ORIGINAL_X + ROOT_VIEW_WIDTH + PADDING, ORIGINAL_Y));
         anotherView.setSize(new Size(50, 50));
         workspace.addView(anotherView);
 
         newView.setupRequiredSize(new Size(NEW_VIEW_WIDTH, NEW_VIEW_HEIGHT));
 
-        Location location = strategy.determinePlacement(workspace, existingView, newView);
-        Assert.assertEquals(new Location(ORIGINAL_X + ROOT_VIEW_WIDTH + PADDING + PADDING * 4, ORIGINAL_Y + PADDING * 4), location);
+        final Location location = strategy.determinePlacement(workspace, existingView, newView);
+        Assert.assertEquals(
+            new Location(ORIGINAL_X + ROOT_VIEW_WIDTH + PADDING + PADDING * 4, ORIGINAL_Y + PADDING * 4), location);
     }
 
     @Test
     public void placeBelow() throws Exception {
         existingView.setLocation(new Location(WORKSPACE_WIDTH - 200, 100));
 
-        Location location = strategy.determinePlacement(workspace, existingView, newView);
+        final Location location = strategy.determinePlacement(workspace, existingView, newView);
         Assert.assertEquals(new Location(WORKSPACE_WIDTH - 200, 100 + +ROOT_VIEW_HEIGHT + PADDING), location);
     }
 
@@ -104,7 +103,7 @@ public class PlacementStrategyImplTest {
     public void placeToLeft() throws Exception {
         existingView.setLocation(new Location(WORKSPACE_WIDTH - 200, 500));
 
-        Location location = strategy.determinePlacement(workspace, existingView, newView);
+        final Location location = strategy.determinePlacement(workspace, existingView, newView);
         Assert.assertEquals(new Location(WORKSPACE_WIDTH - 200 - PADDING - NEW_VIEW_WIDTH, 500), location);
     }
 
@@ -113,7 +112,7 @@ public class PlacementStrategyImplTest {
         existingView.setLocation(new Location(100, 700));
         existingView.setSize(new Size(900, 100));
 
-        Location location = strategy.determinePlacement(workspace, existingView, newView);
+        final Location location = strategy.determinePlacement(workspace, existingView, newView);
         Assert.assertEquals(new Location(100, 700 - NEW_VIEW_HEIGHT - PADDING), location);
     }
 
@@ -122,17 +121,17 @@ public class PlacementStrategyImplTest {
         existingView.setLocation(new Location(100, 100));
         newView.setupRequiredSize(new Size(1100, 900));
 
-        Location location = strategy.determinePlacement(workspace, existingView, newView);
-        Assert.assertEquals("should be placed on top of original, but slightly offset",  new Location(0, 0), location);
+        final Location location = strategy.determinePlacement(workspace, existingView, newView);
+        Assert.assertEquals("should be placed on top of original, but slightly offset", new Location(0, 0), location);
     }
 
     @Test
     public void viewLargerThanWorkspaceAndExisitingViewInCorner() throws Exception {
         existingView.setLocation(new Location(200, 300));
-        existingView.setLocation(new Location(0,0));
+        existingView.setLocation(new Location(0, 0));
         newView.setupRequiredSize(new Size(1100, 900));
 
-        Location location = strategy.determinePlacement(workspace, existingView, newView);
+        final Location location = strategy.determinePlacement(workspace, existingView, newView);
         Assert.assertEquals("should be placed on top of original, but slightly offset", new Location(0, 0), location);
     }
 
@@ -141,62 +140,59 @@ public class PlacementStrategyImplTest {
         existingView.setLocation(new Location(100, 100));
         existingView.setSize(new Size(800, 600));
 
-        Location location = strategy.determinePlacement(workspace, existingView, newView);
+        final Location location = strategy.determinePlacement(workspace, existingView, newView);
         Assert.assertEquals("should be placed on top of original, but slightly offset", new Location(100 + PADDING * 6,
-                100 + PADDING * 6), location);
+            100 + PADDING * 6), location);
     }
 
     @Test
     public void wideComponentShiftsToLeft() throws Exception {
         newView.setupRequiredSize(new Size(1200, NEW_VIEW_HEIGHT));
-        
-        Location location = strategy.determinePlacement(workspace, existingView, newView);
+
+        final Location location = strategy.determinePlacement(workspace, existingView, newView);
         Assert.assertEquals(new Location(0, ORIGINAL_Y + ROOT_VIEW_HEIGHT + PADDING), location);
     }
 
     @Test
     public void tallComponentShiftsUp() throws Exception {
         newView.setupRequiredSize(new Size(NEW_VIEW_WIDTH, 1000));
-        
-        Location location = strategy.determinePlacement(workspace, existingView, newView);
+
+        final Location location = strategy.determinePlacement(workspace, existingView, newView);
         Assert.assertEquals(new Location(ORIGINAL_X + ROOT_VIEW_WIDTH + PADDING, 0), location);
     }
 
     @Test
     public void wideComponentsDontCompletelyOverlap() throws Exception {
-        DummyView anotherView = new DummyView();
+        final DummyView anotherView = new DummyView();
         anotherView.setLocation(new Location(0, 70 + ROOT_VIEW_HEIGHT + PADDING));
         anotherView.setSize(new Size(WORKSPACE_WIDTH, 100));
         workspace.addView(anotherView);
-        
+
         newView.setupRequiredSize(new Size(WORKSPACE_WIDTH, NEW_VIEW_HEIGHT));
-        
-        Location location = strategy.determinePlacement(workspace, existingView, newView);
+
+        final Location location = strategy.determinePlacement(workspace, existingView, newView);
         Assert.assertEquals(new Location(0, 70 + ROOT_VIEW_HEIGHT + PADDING + PADDING * 4), location);
     }
 
     @Test
     public void tallComponentsDontCompletelyOverlap() throws Exception {
-        DummyView anotherView = new DummyView();
+        final DummyView anotherView = new DummyView();
         anotherView.setLocation(new Location(ORIGINAL_X + ROOT_VIEW_WIDTH + PADDING, 0));
         anotherView.setSize(new Size(100, WORKSPACE_HEIGHT));
         workspace.addView(anotherView);
-        
+
         newView.setupRequiredSize(new Size(NEW_VIEW_WIDTH, WORKSPACE_HEIGHT));
-        
-        Location location = strategy.determinePlacement(workspace, existingView, newView);
+
+        final Location location = strategy.determinePlacement(workspace, existingView, newView);
         Assert.assertEquals(new Location(ORIGINAL_X + ROOT_VIEW_WIDTH + PADDING + PADDING * 4, 0), location);
     }
-    
 
     @Test
     public void noSpaceToMoveNewView() throws Exception {
         newView.setupRequiredSize(new Size(WORKSPACE_WIDTH - ORIGINAL_X, WORKSPACE_HEIGHT - ORIGINAL_Y));
-        
-        Location location = strategy.determinePlacement(workspace, existingView, newView);
+
+        final Location location = strategy.determinePlacement(workspace, existingView, newView);
         Assert.assertEquals(new Location(ORIGINAL_X, ORIGINAL_Y), location);
     }
 
-
 }
-

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/ScrollBorderTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/ScrollBorderTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/ScrollBorderTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/ScrollBorderTest.java Tue May  3 07:18:19 2011
@@ -17,23 +17,11 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.viewer.basic;
 
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.log4j.Level;
-import org.apache.log4j.LogManager;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.integration.junit4.JMock;
-import org.jmock.integration.junit4.JUnit4Mockery;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 import org.apache.isis.core.commons.config.IsisConfigurationDefault;
 import org.apache.isis.core.metamodel.spec.SpecificationLoader;
 import org.apache.isis.core.runtime.authentication.AuthenticationManager;
@@ -52,13 +40,22 @@ import org.apache.isis.viewer.dnd.drawin
 import org.apache.isis.viewer.dnd.view.View;
 import org.apache.isis.viewer.dnd.view.ViewAreaType;
 import org.apache.isis.viewer.dnd.view.border.ScrollBorder;
-
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JMock;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 @RunWith(JMock.class)
 public class ScrollBorderTest {
 
-    private Mockery mockery = new JUnit4Mockery();
-    
+    private final Mockery mockery = new JUnit4Mockery();
+
     protected TemplateImageLoader mockTemplateImageLoader;
     protected SpecificationLoader mockSpecificationLoader;
     protected PersistenceSessionFactory mockPersistenceSessionFactory;
@@ -66,16 +63,14 @@ public class ScrollBorderTest {
     protected AuthenticationManager mockAuthenticationManager;
     protected AuthorizationManager mockAuthorizationManager;
 
-	private List<Object> servicesList;
-
-
+    private List<Object> servicesList;
 
     @Before
     public void setUp() throws Exception {
         LogManager.getRootLogger().setLevel(Level.OFF);
 
         servicesList = Collections.emptyList();
-        
+
         mockTemplateImageLoader = mockery.mock(TemplateImageLoader.class);
         mockSpecificationLoader = mockery.mock(SpecificationLoader.class);
         mockUserProfileLoader = mockery.mock(UserProfileLoader.class);
@@ -96,24 +91,18 @@ public class ScrollBorderTest {
 
         TestToolkit.createInstance();
 
-        IsisConfigurationDefault configuration = new IsisConfigurationDefault();
-        IsisSessionFactory sessionFactory = 
-            new IsisSessionFactoryDefault(
-                    DeploymentType.EXPLORATION, 
-                    configuration, 
-                    mockTemplateImageLoader, 
-                    mockSpecificationLoader, 
-                    mockAuthenticationManager, 
-    		        mockAuthorizationManager,
-                    mockUserProfileLoader, 
-                    mockPersistenceSessionFactory, servicesList);
+        final IsisConfigurationDefault configuration = new IsisConfigurationDefault();
+        final IsisSessionFactory sessionFactory =
+            new IsisSessionFactoryDefault(DeploymentType.EXPLORATION, configuration, mockTemplateImageLoader,
+                mockSpecificationLoader, mockAuthenticationManager, mockAuthorizationManager, mockUserProfileLoader,
+                mockPersistenceSessionFactory, servicesList);
         sessionFactory.init();
         IsisContextStatic.createRelaxedInstance(sessionFactory);
     }
 
     @Test
     public void testScrollBar() {
-        DummyView innerView = new DummyView();
+        final DummyView innerView = new DummyView();
         innerView.setupRequiredSize(new Size(100, 200));
         final View view = new ScrollBorder(innerView);
 

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/SimpleCollectionSorterTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/SimpleCollectionSorterTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/SimpleCollectionSorterTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/SimpleCollectionSorterTest.java Tue May  3 07:18:19 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.viewer.basic;
 
 import junit.framework.TestCase;
@@ -28,7 +27,6 @@ import org.apache.isis.viewer.dnd.view.c
 import org.apache.isis.viewer.dnd.view.collection.SimpleCollectionSorter;
 import org.apache.isis.viewer.dnd.view.collection.TitleComparator;
 
-
 public class SimpleCollectionSorterTest extends TestCase {
 
     public static void main(final String[] args) {
@@ -36,7 +34,8 @@ public class SimpleCollectionSorterTest 
     }
 
     public void testSortByTitle() {
-        final ObjectAdapter[] instances = new ObjectAdapter[] { object("one"), object("two"), object("three"), object("four"), };
+        final ObjectAdapter[] instances =
+            new ObjectAdapter[] { object("one"), object("two"), object("three"), object("four"), };
 
         final SimpleCollectionSorter sorter = new SimpleCollectionSorter();
         sorter.sort(instances, new TitleComparator(), CollectionSorter.NORMAL);
@@ -48,7 +47,8 @@ public class SimpleCollectionSorterTest 
     }
 
     public void testSortByTitleReversed() {
-        final ObjectAdapter[] instances = new ObjectAdapter[] { object("one"), object("two"), object("three"), object("four"), };
+        final ObjectAdapter[] instances =
+            new ObjectAdapter[] { object("one"), object("two"), object("three"), object("four"), };
 
         final SimpleCollectionSorter sorter = new SimpleCollectionSorter();
         sorter.sort(instances, new TitleComparator(), CollectionSorter.REVERSED);

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/TitleTextTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/TitleTextTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/TitleTextTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/basic/TitleTextTest.java Tue May  3 07:18:19 2011
@@ -17,9 +17,8 @@
  *  under the License.
  */
 
+package org.apache.isis.viewer.dnd.viewer.basic;
 
-package org.apache.isis.viewer.dnd.viewer.basic;
-
 import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
 import org.apache.isis.runtimes.dflt.runtime.testsystem.ProxyJunit3TestCase;
 import org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyConfiguration;
@@ -32,100 +31,85 @@ import org.apache.isis.viewer.dnd.drawin
 import org.apache.isis.viewer.dnd.view.Toolkit;
 import org.apache.isis.viewer.dnd.view.text.TitleText;
 import org.apache.isis.viewer.dnd.viewer.drawing.DummyText;
-
-
-public class TitleTextTest extends ProxyJunit3TestCase {
-    private TitleText titleText;
-    private String title;
-    private TestCanvas canvas;
-    private DummyView view;
-
-    public static void main(final String[] args) {
-        junit.textui.TestRunner.run(TitleTextTest.class);
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        IsisContext.setConfiguration(new TestProxyConfiguration());
-        TestToolkit.createInstance();
-
-        view = new DummyView();
-        final Text style = new DummyText();
-        titleText = new TitleText(view, style, Toolkit.getColor(ColorsAndFonts.COLOR_BLACK)) {
-            @Override
-            protected String title() {
-                return title;
-            }
-        };
-        canvas = new TestCanvas();
-    }
-
-    // TODO these tests won't work on server that doesn't have graphics - eg a Linux box without X
-/*
-    public void XXtestDrawCanvas() {
-        title = "abcde";
-        titleText.draw(canvas, 10, 20);
-    }
-
-    public void testDrawCanvasDefaultColor() {
-        titleText.draw(canvas, 10, 20);
-        assertEquals(Toolkit.getColor(ColorsAndFonts.COLOR_BLACK), canvas.color);
-    }
-
-    public void testDrawCanvasCanDrop() {
-        view.getState().setCanDrop();
-
-        titleText.draw(canvas, 10, 20);
-        assertEquals(Toolkit.getColor(ColorsAndFonts.COLOR_VALID), canvas.color);
-    }
-
-    public void testDrawCanvasCantDrop() {
-        view.getState().setCantDrop();
-
-        titleText.draw(canvas, 10, 20);
-        assertEquals(ColorsAndFonts.COLOR_INVALID, canvas.color);
-    }
-
-    public void testDrawCanvasIdentifier() {
-        view.getState().setContentIdentified();
-
-        titleText.draw(canvas, 10, 20);
-        assertEquals(Toolkit.getColor("primary1"), canvas.color);
-    }
-*/
-    public void testDrawingLocation() {
-        titleText.draw(canvas, 10, 20);
-        assertEquals(10, canvas.x);
-        assertEquals(20, canvas.y);
-    }
-
-    public void testDrawingText() {
-        title = "test string";
-        titleText.draw(canvas, 10, 20);
-        assertEquals("test string", canvas.text);
-    }
-
-    public void testGetSize() {
-        title = "abcde";
-
-        assertEquals(10 * 5, titleText.getSize().getWidth());
-        assertEquals(8, titleText.getSize().getHeight());
-    }
-
-}
-
-class TestCanvas extends DummyCanvas {
-    String text;
-    int x;
-    int y;
-    Color color;
-
-    @Override
-    public void drawText(final String text, final int x, final int y, final Color color, final Text style) {
-        this.text = text;
-        this.x = x;
-        this.y = y;
-        this.color = color;
-    }
-
-}
+
+public class TitleTextTest extends ProxyJunit3TestCase {
+    private TitleText titleText;
+    private String title;
+    private TestCanvas canvas;
+    private DummyView view;
+
+    public static void main(final String[] args) {
+        junit.textui.TestRunner.run(TitleTextTest.class);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        IsisContext.setConfiguration(new TestProxyConfiguration());
+        TestToolkit.createInstance();
+
+        view = new DummyView();
+        final Text style = new DummyText();
+        titleText = new TitleText(view, style, Toolkit.getColor(ColorsAndFonts.COLOR_BLACK)) {
+            @Override
+            protected String title() {
+                return title;
+            }
+        };
+        canvas = new TestCanvas();
+    }
+
+    // TODO these tests won't work on server that doesn't have graphics - eg a Linux box without X
+    /*
+     * public void XXtestDrawCanvas() { title = "abcde"; titleText.draw(canvas, 10, 20); }
+     * 
+     * public void testDrawCanvasDefaultColor() { titleText.draw(canvas, 10, 20);
+     * assertEquals(Toolkit.getColor(ColorsAndFonts.COLOR_BLACK), canvas.color); }
+     * 
+     * public void testDrawCanvasCanDrop() { view.getState().setCanDrop();
+     * 
+     * titleText.draw(canvas, 10, 20); assertEquals(Toolkit.getColor(ColorsAndFonts.COLOR_VALID), canvas.color); }
+     * 
+     * public void testDrawCanvasCantDrop() { view.getState().setCantDrop();
+     * 
+     * titleText.draw(canvas, 10, 20); assertEquals(ColorsAndFonts.COLOR_INVALID, canvas.color); }
+     * 
+     * public void testDrawCanvasIdentifier() { view.getState().setContentIdentified();
+     * 
+     * titleText.draw(canvas, 10, 20); assertEquals(Toolkit.getColor("primary1"), canvas.color); }
+     */
+    public void testDrawingLocation() {
+        titleText.draw(canvas, 10, 20);
+        assertEquals(10, canvas.x);
+        assertEquals(20, canvas.y);
+    }
+
+    public void testDrawingText() {
+        title = "test string";
+        titleText.draw(canvas, 10, 20);
+        assertEquals("test string", canvas.text);
+    }
+
+    public void testGetSize() {
+        title = "abcde";
+
+        assertEquals(10 * 5, titleText.getSize().getWidth());
+        assertEquals(8, titleText.getSize().getHeight());
+    }
+
+}
+
+class TestCanvas extends DummyCanvas {
+    String text;
+    int x;
+    int y;
+    Color color;
+
+    @Override
+    public void drawText(final String text, final int x, final int y, final Color color, final Text style) {
+        this.text = text;
+        this.x = x;
+        this.y = y;
+        this.color = color;
+    }
+
+}

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/builder/StackLayoutTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/builder/StackLayoutTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/builder/StackLayoutTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/builder/StackLayoutTest.java Tue May  3 07:18:19 2011
@@ -17,20 +17,18 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.viewer.builder;
 
 import junit.framework.Assert;
 
-import org.junit.Before;
-import org.junit.Test;
 import org.apache.isis.viewer.dnd.DummyView;
 import org.apache.isis.viewer.dnd.DummyViewSpecification;
 import org.apache.isis.viewer.dnd.DummyWorkspaceView;
 import org.apache.isis.viewer.dnd.drawing.Size;
 import org.apache.isis.viewer.dnd.view.View;
 import org.apache.isis.viewer.dnd.view.composite.StackLayout;
-
+import org.junit.Before;
+import org.junit.Test;
 
 public class StackLayoutTest {
     private StackLayout layout;
@@ -53,14 +51,14 @@ public class StackLayoutTest {
 
     @Test
     public void noContentNoSize() throws Exception {
-        View view = new DummyView();
+        final View view = new DummyView();
         Assert.assertEquals(new Size(), layout.getRequiredSize(view));
     }
 
     @Test
     public void sameSizeAsOnlyComponent() throws Exception {
-        View view = new DummyWorkspaceView();
-        DummyView subview = new DummyView();
+        final View view = new DummyWorkspaceView();
+        final DummyView subview = new DummyView();
         subview.setupRequiredSize(new Size(100, 20));
         view.addView(subview);
 
@@ -69,8 +67,8 @@ public class StackLayoutTest {
 
     @Test
     public void sameWidthAsWidestComponentAndHeightTotalOfAll() throws Exception {
-        View view = new DummyWorkspaceView();
-         view.addView(subview1);
+        final View view = new DummyWorkspaceView();
+        view.addView(subview1);
         view.addView(subview2);
 
         Assert.assertEquals(new Size(120, 40), layout.getRequiredSize(view));
@@ -78,23 +76,22 @@ public class StackLayoutTest {
 
     @Test
     public void layoutToMaxWidth() throws Exception {
-        View view = new DummyWorkspaceView();
+        final View view = new DummyWorkspaceView();
         view.addView(subview1);
         view.addView(subview2);
-        
+
         layout.layout(view, new Size(110, 60));
 
         Assert.assertEquals(new Size(100, 20), subview1.getSize());
         Assert.assertEquals(new Size(110, 20), subview2.getSize());
     }
 
-
     @Test
     public void layoutFixedWidth() throws Exception {
-        View view = new DummyWorkspaceView();
+        final View view = new DummyWorkspaceView();
         view.addView(subview1);
         view.addView(subview2);
-        
+
         layout = new StackLayout(true);
         layout.layout(view, Size.createMax());
 
@@ -103,4 +100,3 @@ public class StackLayoutTest {
     }
 
 }
-

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/content/TextParseableField_ParseTextEntry.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/content/TextParseableField_ParseTextEntry.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/content/TextParseableField_ParseTextEntry.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/content/TextParseableField_ParseTextEntry.java Tue May  3 07:18:19 2011
@@ -17,17 +17,7 @@
  *  under the License.
  */
 
-
-package org.apache.isis.viewer.dnd.viewer.content;
-
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.integration.junit4.JMock;
-import org.jmock.integration.junit4.JUnit4Mockery;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+package org.apache.isis.viewer.dnd.viewer.content;
 
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.consent.Allow;
@@ -39,147 +29,154 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
 import org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxySystem;
 import org.apache.isis.viewer.dnd.view.field.TextParseableFieldImpl;
-
-
-@RunWith(JMock.class)
-public class TextParseableField_ParseTextEntry {
-
-    private final Mockery context = new JUnit4Mockery();
-
-    private ObjectAdapter mockParent;
-    private ObjectAdapter mockChild;
-    private OneToOneAssociation mockOtoa;
-    private ObjectSpecification mockOtoaSpec;
-    private ParseableFacet mockParseableFacet;
-    private ObjectAdapter mockParsedText;
-    private TextParseableFieldImpl fieldImpl;
-
-    private ValidatingInteractionAdvisor mockValidatingInteractionAdvisorFacet;
-
-    private TestProxySystem system;
-
-    @Before
-    public void setUp() throws Exception {
-        system = new TestProxySystem();
-        system.init();
-
-        mockParent = context.mock(ObjectAdapter.class, "parent");
-        mockChild = context.mock(ObjectAdapter.class, "child");
-        mockOtoa = context.mock(OneToOneAssociation.class);
-        mockOtoaSpec = context.mock(ObjectSpecification.class);
-        mockParseableFacet = context.mock(ParseableFacet.class);
-        mockParsedText = context.mock(ObjectAdapter.class, "parsedText");
-        mockValidatingInteractionAdvisorFacet = context.mock(ValidatingInteractionAdvisor.class);
-
-        context.checking(new Expectations() {
-            {
-                allowing(mockOtoa).getIdentifier();
-
-                allowing(mockOtoa).getSpecification();
-                will(returnValue(mockOtoaSpec));
-
-                one(mockOtoaSpec).getFacet(ParseableFacet.class);
-                will(returnValue(mockParseableFacet));
-            }
-        });
-
-        fieldImpl = new TextParseableFieldImpl(mockParent, mockChild, mockOtoa);
-    }
-
-    @After
-    public void tearDown() throws Exception {
-
-    }
-
-    @Test
-    public void parsedTextIsValidForSpecAndCorrespondingObjectValidAsAssociation() {
-
-        context.checking(new Expectations() {
-            {
-                one(mockParseableFacet).parseTextEntry(mockChild, "foo");
-                will(returnValue(mockParsedText));
-
-                atLeast(1).of(mockOtoa).isAssociationValid(mockParent, mockParsedText);
-                will(returnValue(Allow.DEFAULT));
-
-                one(mockOtoa).isMandatory();
-            }
-        });
-
-        fieldImpl.parseTextEntry("foo");
-    }
-
-    @Test(expected = InvalidEntryException.class)
-    public void parsedTextIsNullWhenMandatoryThrowsException() {
-
-        context.checking(new Expectations() {
-            {
-                one(mockParseableFacet).parseTextEntry(mockChild, "foo");
-                will(returnValue(null));
-
-                atLeast(1).of(mockOtoa).isAssociationValid(mockParent, null);
-                will(returnValue(Allow.DEFAULT));
-
-                one(mockOtoa).isMandatory();
-                will(returnValue(true));
-            }
-        });
-
-        fieldImpl.parseTextEntry("foo");
-    }
-
-    @Test
-    public void parsedTextIsValidAccordingToSpecificationFacet() {
-
-        context.checking(new Expectations() {
-            {
-                one(mockParseableFacet).parseTextEntry(mockChild, "foo");
-                will(returnValue(mockParsedText));
-
-                atLeast(1).of(mockOtoa).isAssociationValid(mockParent, mockParsedText);
-                will(returnValue(Allow.DEFAULT));
-
-                allowing(mockOtoa).isMandatory();
-                will(returnValue(true));
-            }
-        });
-
-        fieldImpl.parseTextEntry("foo");
-    }
-
-    @Test(expected = InvalidEntryException.class)
-    public void parsedTextIsInvalidAccordingToSpecification() {
-
-        context.checking(new Expectations() {
-            {
-                allowing(mockParseableFacet).parseTextEntry(mockChild, "foo");
-                will(returnValue(mockParsedText));
-
-                atLeast(1).of(mockOtoa).isAssociationValid(mockParent, mockParsedText);
-                will(returnValue(Veto.DEFAULT));
-
-                allowing(mockOtoa).isMandatory();
-                will(returnValue(true));
-            }
-        });
-
-        fieldImpl.parseTextEntry("foo");
-    }
-
-    @Test(expected = InvalidEntryException.class)
-    public void parsedTextIsInvalidAccordingToAssociation() {
-
-        context.checking(new Expectations() {
-            {
-                allowing(mockParseableFacet).parseTextEntry(mockChild, "foo");
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JMock;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(JMock.class)
+public class TextParseableField_ParseTextEntry {
+
+    private final Mockery context = new JUnit4Mockery();
+
+    private ObjectAdapter mockParent;
+    private ObjectAdapter mockChild;
+    private OneToOneAssociation mockOtoa;
+    private ObjectSpecification mockOtoaSpec;
+    private ParseableFacet mockParseableFacet;
+    private ObjectAdapter mockParsedText;
+    private TextParseableFieldImpl fieldImpl;
+
+    private ValidatingInteractionAdvisor mockValidatingInteractionAdvisorFacet;
+
+    private TestProxySystem system;
+
+    @Before
+    public void setUp() throws Exception {
+        system = new TestProxySystem();
+        system.init();
+
+        mockParent = context.mock(ObjectAdapter.class, "parent");
+        mockChild = context.mock(ObjectAdapter.class, "child");
+        mockOtoa = context.mock(OneToOneAssociation.class);
+        mockOtoaSpec = context.mock(ObjectSpecification.class);
+        mockParseableFacet = context.mock(ParseableFacet.class);
+        mockParsedText = context.mock(ObjectAdapter.class, "parsedText");
+        mockValidatingInteractionAdvisorFacet = context.mock(ValidatingInteractionAdvisor.class);
+
+        context.checking(new Expectations() {
+            {
+                allowing(mockOtoa).getIdentifier();
+
+                allowing(mockOtoa).getSpecification();
+                will(returnValue(mockOtoaSpec));
+
+                one(mockOtoaSpec).getFacet(ParseableFacet.class);
+                will(returnValue(mockParseableFacet));
+            }
+        });
+
+        fieldImpl = new TextParseableFieldImpl(mockParent, mockChild, mockOtoa);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+
+    }
+
+    @Test
+    public void parsedTextIsValidForSpecAndCorrespondingObjectValidAsAssociation() {
+
+        context.checking(new Expectations() {
+            {
+                one(mockParseableFacet).parseTextEntry(mockChild, "foo");
                 will(returnValue(mockParsedText));
-                
-                one(mockOtoa).isAssociationValid(mockParent, mockParsedText);
+
+                atLeast(1).of(mockOtoa).isAssociationValid(mockParent, mockParsedText);
+                will(returnValue(Allow.DEFAULT));
+
+                one(mockOtoa).isMandatory();
+            }
+        });
+
+        fieldImpl.parseTextEntry("foo");
+    }
+
+    @Test(expected = InvalidEntryException.class)
+    public void parsedTextIsNullWhenMandatoryThrowsException() {
+
+        context.checking(new Expectations() {
+            {
+                one(mockParseableFacet).parseTextEntry(mockChild, "foo");
+                will(returnValue(null));
+
+                atLeast(1).of(mockOtoa).isAssociationValid(mockParent, null);
+                will(returnValue(Allow.DEFAULT));
+
+                one(mockOtoa).isMandatory();
+                will(returnValue(true));
+            }
+        });
+
+        fieldImpl.parseTextEntry("foo");
+    }
+
+    @Test
+    public void parsedTextIsValidAccordingToSpecificationFacet() {
+
+        context.checking(new Expectations() {
+            {
+                one(mockParseableFacet).parseTextEntry(mockChild, "foo");
+                will(returnValue(mockParsedText));
+
+                atLeast(1).of(mockOtoa).isAssociationValid(mockParent, mockParsedText);
+                will(returnValue(Allow.DEFAULT));
+
+                allowing(mockOtoa).isMandatory();
+                will(returnValue(true));
+            }
+        });
+
+        fieldImpl.parseTextEntry("foo");
+    }
+
+    @Test(expected = InvalidEntryException.class)
+    public void parsedTextIsInvalidAccordingToSpecification() {
+
+        context.checking(new Expectations() {
+            {
+                allowing(mockParseableFacet).parseTextEntry(mockChild, "foo");
+                will(returnValue(mockParsedText));
+
+                atLeast(1).of(mockOtoa).isAssociationValid(mockParent, mockParsedText);
+                will(returnValue(Veto.DEFAULT));
+
+                allowing(mockOtoa).isMandatory();
+                will(returnValue(true));
+            }
+        });
+
+        fieldImpl.parseTextEntry("foo");
+    }
+
+    @Test(expected = InvalidEntryException.class)
+    public void parsedTextIsInvalidAccordingToAssociation() {
+
+        context.checking(new Expectations() {
+            {
+                allowing(mockParseableFacet).parseTextEntry(mockChild, "foo");
+                will(returnValue(mockParsedText));
+
+                one(mockOtoa).isAssociationValid(mockParent, mockParsedText);
                 will(returnValue(Veto.DEFAULT));
-            }
-        });
-
-        fieldImpl.parseTextEntry("foo");
-    }
-
-}
+            }
+        });
+
+        fieldImpl.parseTextEntry("foo");
+    }
+
+}

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/BoundsTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/BoundsTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/BoundsTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/BoundsTest.java Tue May  3 07:18:19 2011
@@ -17,18 +17,16 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.viewer.drawing;
 
 import junit.framework.TestCase;
 
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
 import org.apache.isis.viewer.dnd.drawing.Bounds;
 import org.apache.isis.viewer.dnd.drawing.Location;
 import org.apache.isis.viewer.dnd.drawing.Padding;
 import org.apache.isis.viewer.dnd.drawing.Size;
-
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
 
 public class BoundsTest extends TestCase {
 

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/DummyText.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/DummyText.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/DummyText.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/DummyText.java Tue May  3 07:18:19 2011
@@ -17,59 +17,69 @@
  *  under the License.
  */
 
+package org.apache.isis.viewer.dnd.viewer.drawing;
 
-package org.apache.isis.viewer.dnd.viewer.drawing;
-
 import org.apache.isis.viewer.dnd.drawing.Text;
-
-public class DummyText implements Text {
-
-    public DummyText() {
-        super();
-    }
-
-    public int charWidth(final char c) {
-        return 10;
-    }
-
-    public int getAscent() {
-        return 2;
-    }
-
-    public int getDescent() {
-        return 4;
-    }
-
-    public int getMidPoint() {
-        return 1;
-    }
-
-    public int getTextHeight() {
-        return 8;
-    }
-
-    public int getLineHeight() {
-        return getAscent() + getTextHeight() + getDescent();
-    }
-
-    public int getLineSpacing() {
-        return getLineHeight() + 5;
-    }
-
-    public int stringHeight(final String text, final int width) {
-        return getLineHeight();
-    }
-
-    public int stringWidth(final String text) {
-        return text.length() * charWidth('x');
-    }
-
-    public int stringWidth(final String message, final int maxWidth) {
-        return 0;
-    }
-
-    public String getName() {
-        return null;
-    }
-
-}
+
+public class DummyText implements Text {
+
+    public DummyText() {
+        super();
+    }
+
+    @Override
+    public int charWidth(final char c) {
+        return 10;
+    }
+
+    @Override
+    public int getAscent() {
+        return 2;
+    }
+
+    @Override
+    public int getDescent() {
+        return 4;
+    }
+
+    @Override
+    public int getMidPoint() {
+        return 1;
+    }
+
+    @Override
+    public int getTextHeight() {
+        return 8;
+    }
+
+    @Override
+    public int getLineHeight() {
+        return getAscent() + getTextHeight() + getDescent();
+    }
+
+    @Override
+    public int getLineSpacing() {
+        return getLineHeight() + 5;
+    }
+
+    @Override
+    public int stringHeight(final String text, final int width) {
+        return getLineHeight();
+    }
+
+    @Override
+    public int stringWidth(final String text) {
+        return text.length() * charWidth('x');
+    }
+
+    @Override
+    public int stringWidth(final String message, final int maxWidth) {
+        return 0;
+    }
+
+    @Override
+    public String getName() {
+        return null;
+    }
+
+}

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/LocationTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/LocationTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/LocationTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/LocationTest.java Tue May  3 07:18:19 2011
@@ -17,13 +17,11 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.viewer.drawing;
 
-import org.apache.isis.viewer.dnd.drawing.Location;
-
 import junit.framework.TestCase;
 
+import org.apache.isis.viewer.dnd.drawing.Location;
 
 public class LocationTest extends TestCase {
 

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/PaddingTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/PaddingTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/PaddingTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/PaddingTest.java Tue May  3 07:18:19 2011
@@ -17,13 +17,11 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.viewer.drawing;
 
-import org.apache.isis.viewer.dnd.drawing.Padding;
-
 import junit.framework.TestCase;
 
+import org.apache.isis.viewer.dnd.drawing.Padding;
 
 public class PaddingTest extends TestCase {
 

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/ShapeTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/ShapeTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/ShapeTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/ShapeTest.java Tue May  3 07:18:19 2011
@@ -17,13 +17,11 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.viewer.drawing;
 
-import org.apache.isis.viewer.dnd.drawing.Shape;
-
 import junit.framework.TestCase;
 
+import org.apache.isis.viewer.dnd.drawing.Shape;
 
 public class ShapeTest extends TestCase {
 

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/ShapeTest2.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/ShapeTest2.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/ShapeTest2.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/ShapeTest2.java Tue May  3 07:18:19 2011
@@ -17,13 +17,11 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.viewer.drawing;
 
-import org.apache.isis.viewer.dnd.drawing.Shape;
-
 import junit.framework.TestCase;
 
+import org.apache.isis.viewer.dnd.drawing.Shape;
 
 public class ShapeTest2 extends TestCase {
 

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/SizeTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/SizeTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/SizeTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/drawing/SizeTest.java Tue May  3 07:18:19 2011
@@ -17,16 +17,14 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.viewer.drawing;
 
 import junit.framework.TestCase;
 
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
 import org.apache.isis.viewer.dnd.drawing.Padding;
 import org.apache.isis.viewer.dnd.drawing.Size;
-
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
 
 public class SizeTest extends TestCase {
 

Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/table/TableRowLayoutTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/table/TableRowLayoutTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/table/TableRowLayoutTest.java (original)
+++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/table/TableRowLayoutTest.java Tue May  3 07:18:19 2011
@@ -17,14 +17,10 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.dnd.viewer.table;
 
 import junit.framework.Assert;
 
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.junit.Test;
 import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
 import org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyConfiguration;
 import org.apache.isis.viewer.dnd.DummyView;
@@ -33,7 +29,9 @@ import org.apache.isis.viewer.dnd.drawin
 import org.apache.isis.viewer.dnd.table.TableAxis;
 import org.apache.isis.viewer.dnd.table.TableRowLayout;
 import org.apache.isis.viewer.dnd.view.View;
-
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.junit.Test;
 
 public class TableRowLayoutTest {
 
@@ -41,30 +39,31 @@ public class TableRowLayoutTest {
     public void layout() throws Exception {
         IsisContext.setConfiguration(new TestProxyConfiguration());
         TestToolkit.createInstance();
-        
-        
-        DummyView row = new DummyView();
-        DummyView cell1 = new DummyView();
-        DummyView cell2 = new DummyView();
+
+        final DummyView row = new DummyView();
+        final DummyView cell1 = new DummyView();
+        final DummyView cell2 = new DummyView();
         row.setupSubviews(new View[] { cell1, cell2 });
-        
-        Mockery mockery = new Mockery();
+
+        final Mockery mockery = new Mockery();
         final TableAxis tableAxis = mockery.mock(TableAxis.class);
-        
-        mockery.checking(new Expectations() {{
-            one(tableAxis).getColumnWidth(0); will(returnValue(80));
-            one(tableAxis).getColumnWidth(1); will(returnValue(80));
-        }});
-
-        TableRowLayout layout = new TableRowLayout(tableAxis);
-       
-        
+
+        mockery.checking(new Expectations() {
+            {
+                one(tableAxis).getColumnWidth(0);
+                will(returnValue(80));
+                one(tableAxis).getColumnWidth(1);
+                will(returnValue(80));
+            }
+        });
+
+        final TableRowLayout layout = new TableRowLayout(tableAxis);
+
         layout.layout(row, new Size(200, 200));
         mockery.assertIsSatisfied();
-        
+
         Assert.assertEquals(new Size(80, 10), cell1.getSize());
         Assert.assertEquals(new Size(80, 10), cell2.getSize());
-        
+
     }
 }
-



Mime
View raw message