Author: hadrian
Date: Fri Dec 14 21:10:31 2012
New Revision: 1422091

URL: http://svn.apache.org/viewvc?rev=1422091&view=rev
Log:
Test for cast of dynamic proxy to unimplemented interface

Modified:
    
ode/trunk/jacob/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java

Modified: 
ode/trunk/jacob/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/jacob/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java?rev=1422091&r1=1422090&r2=1422091&view=diff
==============================================================================
--- 
ode/trunk/jacob/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java
 (original)
+++ 
ode/trunk/jacob/src/test/java/org/apache/ode/jacob/vpu/ProxyConstructorTimingTest.java
 Fri Dec 14 21:10:31 2012
@@ -22,6 +22,8 @@ import java.lang.reflect.InvocationHandl
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 
+import org.apache.ode.jacob.Channel;
+
 import junit.framework.TestCase;
 
 
@@ -32,6 +34,10 @@ public class ProxyConstructorTimingTest 
     }
 
     public void testDoNothing() throws Exception {
+        Greeter gp = (Greeter) 
Proxy.newProxyInstance(Greeter.class.getClassLoader(),
+            new Class<?>[] {Channel.class, Greeter.class}, new 
GreeterInvocationHandler(new GreeterImpl()));
+        assertEquals("Hello World", gp.hello("World"));
+        assertEquals("Implemented by InvocationHandler", 
((Channel)gp).export());
     }
 
     public interface TestExecution {
@@ -135,6 +141,9 @@ public class ProxyConstructorTimingTest 
                    throw new IllegalStateException(String.valueOf(method));
                }
            }
+           if (method.equals(Channel.class.getMethod("export", new Class[] 
{}))) {
+               return "Implemented by InvocationHandler";
+           }
            return method.invoke(greeter, args);
         }    
     }


Reply via email to