tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r489493 [2/2] - in /tapestry/tapestry5/tapestry-core/trunk/src: main/java/org/apache/tapestry/corelib/base/ main/java/org/apache/tapestry/internal/ main/java/org/apache/tapestry/internal/bindings/ main/java/org/apache/tapestry/internal/serv...
Date Thu, 21 Dec 2006 23:09:47 GMT
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/BindingSourceImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/BindingSourceImplTest.java?view=diff&rev=489493&r1=489492&r2=489493
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/BindingSourceImplTest.java
(original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/BindingSourceImplTest.java
Thu Dec 21 15:09:45 2006
@@ -12,155 +12,169 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package org.apache.tapestry.internal.services;
-
+package org.apache.tapestry.internal.services;
+
 import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
-
-import java.util.Map;
-
-import org.apache.tapestry.ComponentResources;
-import org.apache.tapestry.internal.test.InternalBaseTestCase;
+
+import java.util.Map;
+
+import org.apache.tapestry.ComponentResources;
+import org.apache.tapestry.internal.test.InternalBaseTestCase;
 import org.apache.tapestry.ioc.Location;
 import org.apache.tapestry.ioc.internal.util.TapestryException;
 import org.apache.tapestry.services.Binding;
-import org.apache.tapestry.services.BindingFactory;
-import org.apache.tapestry.services.BindingSource;
-import org.testng.annotations.Test;
-
-/**
- * 
- */
-public class BindingSourceImplTest extends InternalBaseTestCase
-{
-    @Test
-    public void expression_has_no_prefix()
-    {
-        BindingFactory factory = newBindingFactory();
-        Binding binding = newBinding();
-        ComponentResources component = newComponentResources();
-        Location l = newLocation();
-
-        String defaultPrefix = "def";
-        String description = "descrip";
-        String expression = "full expression";
-
-        train_newBinding(factory, description, component, expression, l, binding);
-
-        replay();
-
-        Map<String, BindingFactory> map = newMap();
-
-        map.put(defaultPrefix, factory);
-
-        BindingSource source = new BindingSourceImpl(map);
-
-        Binding actual = source.newBinding(description, component, defaultPrefix, expression,
l);
-
-        assertSame(actual, binding);
-
-        verify();
-    }
-
-    @Test
-    public void expression_prefix_not_in_configuration()
-    {
-        BindingFactory factory = newBindingFactory();
-        Binding binding = newBinding();
-        ComponentResources component = newComponentResources();
-        Location l = newLocation();
-
-        String defaultPrefix = "def";
-        String description = "descrip";
-        String expression = "javascript:not-a-known-prefix";
-
-        train_newBinding(factory, description, component, expression, l, binding);
-
-        replay();
-
-        Map<String, BindingFactory> map = newMap();
-
-        map.put(defaultPrefix, factory);
-
-        BindingSource source = new BindingSourceImpl(map);
-
-        Binding actual = source.newBinding(description, component, defaultPrefix, expression,
l);
-
-        assertSame(actual, binding);
-
-        verify();
-    }
-
-    @Test
-    public void known_prefix()
-    {
-        BindingFactory factory = newBindingFactory();
-        Binding binding = newBinding();
-        ComponentResources component = newComponentResources();
-        Location l = newLocation();
-
-        String defaultPrefix = "literal";
-        String description = "descrip";
-
-        // The "prop:" prefix is stripped off ...
-        train_newBinding(factory, description, component, "myproperty", l, binding);
-
-        replay();
-
-        Map<String, BindingFactory> map = newMap();
-
-        map.put("prop", factory);
-
-        BindingSource source = new BindingSourceImpl(map);
-
-        Binding actual = source.newBinding(
-                description,
-                component,
-                defaultPrefix,
-                "prop:myproperty",
-                l);
-
-        assertSame(actual, binding);
-
-        verify();
-    }
-
-    @Test
-    public void factory_throws_exception()
-    {
-        BindingFactory factory = newBindingFactory();
-        ComponentResources component = newComponentResources();
-        Location l = newLocation();
-        Throwable t = new RuntimeException("Simulated failure.");
-
-        String defaultPrefix = "def";
-        String description = "descrip";
-        String expression = "full expression";
-
-        factory.newBinding(description, component, expression, l);
-        setThrowable(t);
-
-        replay();
-
-        Map<String, BindingFactory> map = newMap();
-
-        map.put(defaultPrefix, factory);
-
-        BindingSource source = new BindingSourceImpl(map);
-
-        try
-        {
-            source.newBinding(description, component, defaultPrefix, expression, l);
-            unreachable();
-        }
-        catch (TapestryException ex)
-        {
-            assertTrue(ex.getMessage().contains(
-                    "Could not convert 'full expression' into a component parameter binding"));
-            assertTrue(ex.getMessage().contains(t.getMessage()));
-            assertSame(ex.getLocation(), l);
-            assertSame(ex.getCause(), t);
-        }
-
-        verify();
-    }
-}
+import org.apache.tapestry.services.BindingFactory;
+import org.apache.tapestry.services.BindingSource;
+import org.testng.annotations.Test;
+
+public class BindingSourceImplTest extends InternalBaseTestCase
+{
+    @Test
+    public void expression_has_no_prefix()
+    {
+        BindingFactory factory = newBindingFactory();
+        Binding binding = newBinding();
+        ComponentResources container = newComponentResources();
+        ComponentResources component = newComponentResources();
+        Location l = newLocation();
+
+        String defaultPrefix = "def";
+        String description = "descrip";
+        String expression = "full expression";
+
+        train_newBinding(factory, description, container, component, expression, l, binding);
+
+        replay();
+
+        Map<String, BindingFactory> map = newMap();
+
+        map.put(defaultPrefix, factory);
+
+        BindingSource source = new BindingSourceImpl(map);
+
+        Binding actual = source.newBinding(
+                description,
+                container,
+                component,
+                defaultPrefix,
+                expression,
+                l);
+
+        assertSame(actual, binding);
+
+        verify();
+    }
+
+    @Test
+    public void expression_prefix_not_in_configuration()
+    {
+        BindingFactory factory = newBindingFactory();
+        Binding binding = newBinding();
+        ComponentResources container = newComponentResources();
+        ComponentResources component = newComponentResources();
+        Location l = newLocation();
+
+        String defaultPrefix = "def";
+        String description = "descrip";
+        String expression = "javascript:not-a-known-prefix";
+
+        train_newBinding(factory, description, container, component, expression, l, binding);
+
+        replay();
+
+        Map<String, BindingFactory> map = newMap();
+
+        map.put(defaultPrefix, factory);
+
+        BindingSource source = new BindingSourceImpl(map);
+
+        Binding actual = source.newBinding(
+                description,
+                container,
+                component,
+                defaultPrefix,
+                expression,
+                l);
+
+        assertSame(actual, binding);
+
+        verify();
+    }
+
+    @Test
+    public void known_prefix()
+    {
+        BindingFactory factory = newBindingFactory();
+        Binding binding = newBinding();
+        ComponentResources container = newComponentResources();
+        ComponentResources component = newComponentResources();
+        Location l = newLocation();
+
+        String defaultPrefix = "literal";
+        String description = "descrip";
+
+        // The "prop:" prefix is stripped off ...
+        train_newBinding(factory, description, container, component, "myproperty", l, binding);
+
+        replay();
+
+        Map<String, BindingFactory> map = newMap();
+
+        map.put("prop", factory);
+
+        BindingSource source = new BindingSourceImpl(map);
+
+        Binding actual = source.newBinding(
+                description,
+                container,
+                component,
+                defaultPrefix,
+                "prop:myproperty",
+                l);
+
+        assertSame(actual, binding);
+
+        verify();
+    }
+
+    @Test
+    public void factory_throws_exception()
+    {
+        BindingFactory factory = newBindingFactory();
+        ComponentResources container = newComponentResources();
+        ComponentResources component = newComponentResources();
+        Location l = newLocation();
+        Throwable t = new RuntimeException("Simulated failure.");
+
+        String defaultPrefix = "def";
+        String description = "descrip";
+        String expression = "full expression";
+
+        factory.newBinding(description, container, component, expression, l);
+        setThrowable(t);
+
+        replay();
+
+        Map<String, BindingFactory> map = newMap();
+
+        map.put(defaultPrefix, factory);
+
+        BindingSource source = new BindingSourceImpl(map);
+
+        try
+        {
+            source.newBinding(description, container, component, defaultPrefix, expression,
l);
+            unreachable();
+        }
+        catch (TapestryException ex)
+        {
+            assertTrue(ex.getMessage().contains(
+                    "Could not convert 'full expression' into a component parameter binding"));
+            assertTrue(ex.getMessage().contains(t.getMessage()));
+            assertSame(ex.getLocation(), l);
+            assertSame(ex.getCause(), t);
+        }
+
+        verify();
+    }
+}



Mime
View raw message