You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by th...@apache.org on 2014/06/23 05:05:14 UTC

git commit: Adds tests for TAP5-1493.

Repository: tapestry-5
Updated Branches:
  refs/heads/master a55a5bc59 -> 8d1bf477d


Adds tests for TAP5-1493.

Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/8d1bf477
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/8d1bf477
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/8d1bf477

Branch: refs/heads/master
Commit: 8d1bf477d7e4f378d6599370ec66df66daf73926
Parents: a55a5bc
Author: Thiago H. de Paula Figueiredo <th...@apache.org>
Authored: Mon Jun 23 00:04:40 2014 -0300
Committer: Thiago H. de Paula Figueiredo <th...@apache.org>
Committed: Mon Jun 23 00:04:40 2014 -0300

----------------------------------------------------------------------
 .../services/PropertyConduitSourceImplTest.java | 77 ++++++++++++++++++++
 1 file changed, 77 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/8d1bf477/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImplTest.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImplTest.java b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImplTest.java
index 0e61220..cc99472 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImplTest.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImplTest.java
@@ -875,4 +875,81 @@ public class PropertyConduitSourceImplTest extends InternalBaseTestCase
 
         assertListsEquals(actual, PublicStaticFieldBean.READ_ONLY);
     }
+    
+    // TAP5-1493
+    @Test
+    public void covariant_property_return_type() {
+
+        // example from Howard
+        assertConduitPropertyType(AbstractFoo.class, "bar", AbstractBar.class);
+        assertConduitPropertyType(Foo.class, "bar", Bar.class);
+        
+        // example from Robert
+        assertConduitPropertyType(RobertMyClass.class, "foo.robertBarValue", int.class);
+        
+    }
+    
+    // TAP5-1493
+    public static abstract class AbstractBar
+    {
+    }
+
+    public static class Bar extends AbstractBar
+    {
+    }
+
+    public static abstract class AbstractFoo
+    {
+        public abstract AbstractBar getBar();
+    }
+
+    public static class Foo extends AbstractFoo
+    {
+        Bar bar;
+
+        public Bar getBar()
+        {
+            return bar;
+        }
+    }
+
+    public static interface RobertFoo
+    {
+        int getRobertFooValue();
+    }
+
+    public static interface RobertBar extends RobertFoo
+    {
+        int getRobertBarValue();
+    }
+
+    public static interface RobertBaz
+    {
+        RobertFoo getFoo();
+    }
+
+    public static interface RobertQux extends RobertBaz
+    {
+        RobertBar getFoo();
+    }
+
+    public static class RobertAbstractClass implements RobertBaz
+    {
+        public RobertFoo getFoo()
+        {
+            return null;
+        }
+    }
+
+    public static class RobertMyClass extends RobertAbstractClass implements RobertQux
+    {
+        public RobertBar getFoo()
+        {
+            return null;
+        }
+    }
+    
+    private void assertConduitPropertyType(Class<?> origin, String property, Class<?> expectedType) {
+        assertEquals(expectedType, source.create(origin, property).getPropertyType());
+    }
 }