polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [3/3] zest-java git commit: Some little more coverage for @This injection
Date Tue, 09 Feb 2016 22:44:01 GMT
Some little more coverage for @This injection


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/5f737d52
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/5f737d52
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/5f737d52

Branch: refs/heads/ZEST-132
Commit: 5f737d52fedab2d93fa73e8b7f455e74794cc559
Parents: b87b63a
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Tue Feb 9 23:35:27 2016 +0100
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Tue Feb 9 23:42:28 2016 +0100

----------------------------------------------------------------------
 .../runtime/injection/ThisInjectionTest.java    | 56 ++++++++++++++------
 1 file changed, 39 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/5f737d52/core/runtime/src/test/java/org/apache/zest/runtime/injection/ThisInjectionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/zest/runtime/injection/ThisInjectionTest.java
b/core/runtime/src/test/java/org/apache/zest/runtime/injection/ThisInjectionTest.java
index 7d071fd..d840a5f 100644
--- a/core/runtime/src/test/java/org/apache/zest/runtime/injection/ThisInjectionTest.java
+++ b/core/runtime/src/test/java/org/apache/zest/runtime/injection/ThisInjectionTest.java
@@ -83,17 +83,25 @@ public class ThisInjectionTest
     public static class TestMixin
         implements Test
     {
-        @This
-        Test test;
+        @This Test test;
+        @This TestPrivate testPrivate;
+        Test ctorTest;
+        TestPrivate ctorTestPrivate;
 
-        @This
-        TestPrivate testPrivate;
+        public TestMixin( @This Test test, @This TestPrivate testPrivate )
+        {
+            ctorTest = test;
+            ctorTestPrivate = testPrivate;
+        }
 
+        @Override
         public boolean isInjected()
         {
-            return test != null && !testPrivate.testPrivate().get();
+            return test != null && ctorTest != null &&
+                    !testPrivate.testPrivate().get() && !ctorTestPrivate.testPrivate().get();
         }
 
+        @Override
         public String test()
         {
             return "Foo";
@@ -104,17 +112,23 @@ public class ThisInjectionTest
         extends ConcernOf<Test>
         implements Test
     {
-        @This
-        Test test;
+        @This Test test;
+        @This TestPrivate testPrivate;
+        Test ctorTest;
+        TestPrivate ctorTestPrivate;
 
-        @This
-        TestPrivate testPrivate;
+        public TestConcern( @This Test test, @This TestPrivate testPrivate )
+        {
+            ctorTest = test;
+            ctorTestPrivate = testPrivate;
+        }
 
+        @Override
         public boolean isInjected()
         {
-            return test != null && test.test().equals( "Foo" ) &&
-                   !testPrivate.testPrivate().get() &&
-                   next.isInjected();
+            return test != null && ctorTest != null &&
+                    !testPrivate.testPrivate().get() && !ctorTestPrivate.testPrivate().get()
&&
+                    next.isInjected();
         }
     }
 
@@ -122,14 +136,22 @@ public class ThisInjectionTest
         extends SideEffectOf<Test>
         implements Test
     {
-        @This
-        Test test;
-        @This
-        TestPrivate testPrivate;
+        @This Test test;
+        @This TestPrivate testPrivate;
+        Test ctorTest;
+        TestPrivate ctorTestPrivate;
+
+        public TestSideEffect( @This Test test, @This TestPrivate testPrivate )
+        {
+            ctorTest = test;
+            ctorTestPrivate = testPrivate;
+        }
 
+        @Override
         public boolean isInjected()
         {
-            sideEffectInjected = test != null && !testPrivate.testPrivate().get();
+            sideEffectInjected = test != null && ctorTest != null &&
+                    !testPrivate.testPrivate().get() && !ctorTestPrivate.testPrivate().get();
 
             return false;
         }


Mime
View raw message