commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1520884 - /commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubInterceptorBuilderTest.java
Date Sun, 08 Sep 2013 17:34:37 GMT
Author: mbenson
Date: Sun Sep  8 17:34:37 2013
New Revision: 1520884

URL: http://svn.apache.org/r1520884
Log:
reenable StubInterceptorBuilderTest

Modified:
    commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubInterceptorBuilderTest.java

Modified: commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubInterceptorBuilderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubInterceptorBuilderTest.java?rev=1520884&r1=1520883&r2=1520884&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubInterceptorBuilderTest.java
(original)
+++ commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubInterceptorBuilderTest.java
Sun Sep  8 17:34:37 2013
@@ -18,14 +18,12 @@
 package org.apache.commons.proxy2.stub;
 
 import org.apache.commons.proxy2.Interceptor;
-import org.apache.commons.proxy2.ProxyFactory;
-import org.apache.commons.proxy2.cglib.CglibProxyFactory;
 import org.apache.commons.proxy2.invoker.NullInvoker;
-import org.apache.commons.proxy2.provider.ObjectProviderUtils;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Arrays;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
 
 import static org.junit.Assert.*;
 
@@ -57,43 +55,43 @@ public class StubInterceptorBuilderTest 
                 StubInterface.class);
     }
 
-    //    @Test
-//    public void testWithNestedAnnotations()
-//    {
-//        Interceptor interceptor = builder.trainFor(RetentionWrapper.class, new Trainer<RetentionWrapper>()
-//        {
-//            @Override
-//            protected void train(RetentionWrapper trainee)
-//            {
-//
-//                when(trainee.value()).thenStub(new Trainer<Retention>()
-//                {
-//                    @Override
-//                    protected void train(Retention trainee)
-//                    {
-//                        when(trainee.value()).thenReturn(RetentionPolicy.RUNTIME);
-//                    }
-//                });
-//            }
-//        }).build();
-//        RetentionWrapper wrapper = proxyFactory.createInterceptorProxy(proxyFactory.createInvokerProxy(NullInvoker.INSTANCE),
interceptor, RetentionWrapper.class);
-//        assertNotNull(wrapper.value());
-//        assertEquals(RetentionPolicy.RUNTIME, wrapper.value().value());
-//    }
-//
-//    @Test
-//    public void testWithSimpleAnnotations()
-//    {
-//        Interceptor interceptor = builder.trainFor(Retention.class, new Trainer<Retention>()
-//        {
-//            @Override
-//            protected void train(Retention trainee)
-//            {
-//                when(trainee.value()).thenReturn(RetentionPolicy.RUNTIME);
-//            }
-//        }).build();
-//        Retention wrapper = proxyFactory.createInterceptorProxy(proxyFactory.createInvokerProxy(NullInvoker.INSTANCE),
interceptor, Retention.class);
-//        assertEquals(RetentionPolicy.RUNTIME, wrapper.value());
-//    }
+    @Test
+    public void testWithNestedAnnotations()
+    {
+        Interceptor interceptor = builder.train(new Trainer<RetentionWrapper>()
+        {
+            @Override
+            protected void train(RetentionWrapper trainee)
+            {
+
+                when(trainee.value()).thenStub(new Trainer<Retention>()
+                {
+                    @Override
+                    protected void train(Retention trainee)
+                    {
+                        when(trainee.value()).thenReturn(RetentionPolicy.RUNTIME);
+                    }
+                });
+            }
+        }).build();
+        RetentionWrapper wrapper = proxyFactory.createInterceptorProxy(proxyFactory.createInvokerProxy(NullInvoker.INSTANCE),
interceptor, RetentionWrapper.class);
+        assertNotNull(wrapper.value());
+        assertEquals(RetentionPolicy.RUNTIME, wrapper.value().value());
+    }
+
+    @Test
+    public void testWithSimpleAnnotations()
+    {
+        Interceptor interceptor = builder.train(new Trainer<Retention>()
+        {
+            @Override
+            protected void train(Retention trainee)
+            {
+                when(trainee.value()).thenReturn(RetentionPolicy.RUNTIME);
+            }
+        }).build();
+        Retention wrapper = proxyFactory.createInterceptorProxy(proxyFactory.createInvokerProxy(NullInvoker.INSTANCE),
interceptor, Retention.class);
+        assertEquals(RetentionPolicy.RUNTIME, wrapper.value());
+    }
 
 }



Mime
View raw message