felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r1549038 - in /felix/trunk/ipojo/manipulator/manipulator/src/test/java: org/apache/felix/ipojo/manipulation/InnerClassAdapterTest.java test/inner/ComponentWithInnerClasses.java
Date Sun, 08 Dec 2013 15:12:14 GMT
Author: clement
Date: Sun Dec  8 15:12:14 2013
New Revision: 1549038

URL: http://svn.apache.org/r1549038
Log:
Initial attempt to reproduce FELIX-4347

Modified:
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/InnerClassAdapterTest.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/test/inner/ComponentWithInnerClasses.java

Modified: felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/InnerClassAdapterTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/InnerClassAdapterTest.java?rev=1549038&r1=1549037&r2=1549038&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/InnerClassAdapterTest.java
(original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/InnerClassAdapterTest.java
Sun Dec  8 15:12:14 2013
@@ -29,9 +29,11 @@ import org.mockito.Mockito;
 import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.Arrays;
+import java.util.concurrent.Callable;
 
 import static junit.framework.Assert.assertEquals;
 import static org.fest.assertions.Assertions.assertThat;
@@ -335,6 +337,18 @@ public class InnerClassAdapterTest {
         assertThat((String) bar.invoke(o)).isEqualTo("bar");
     }
 
+//    @Test
+//    public void testThatAnonymousClassDeclaredInStaticFieldsAreNotManipulated() throws
Exception {
+//        Manipulator manipulator = new Manipulator();
+//        String className = "test.inner.ComponentWithInnerClasses";
+//        ManipulatedClassLoader classLoader = manipulate(className, manipulator);
+//
+//        Class clazz = classLoader.findClass(className);
+//        Method method = clazz.getMethod("call");
+//        assertThat(method).isNotNull();
+//        assertThat(method.invoke(null)).isEqualTo(1);
+//    }
+
     private Class findInnerClass(Class[] classes, String name) {
         for (Class clazz : classes) {
             if (clazz.getName().contains(name)) {

Modified: felix/trunk/ipojo/manipulator/manipulator/src/test/java/test/inner/ComponentWithInnerClasses.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/test/java/test/inner/ComponentWithInnerClasses.java?rev=1549038&r1=1549037&r2=1549038&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/test/java/test/inner/ComponentWithInnerClasses.java
(original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/test/java/test/inner/ComponentWithInnerClasses.java
Sun Dec  8 15:12:14 2013
@@ -21,6 +21,8 @@ package test.inner;
 
 import org.apache.felix.ipojo.annotations.Component;
 
+import java.util.concurrent.Callable;
+
 /**
  * A component containing inner classes.
  */
@@ -42,6 +44,7 @@ public class ComponentWithInnerClasses{
     private void doSomethingPrivately() {
 
     }
+
     private boolean flag;
 
     boolean getFlag() {
@@ -52,6 +55,16 @@ public class ComponentWithInnerClasses{
 
     private String foo = "foo";
 
+    public static final Callable<Integer> callable = new Callable<Integer>()
{
+        public Integer call() {
+            return 1;
+        }
+    };
+
+    public static int call() throws Exception {
+        return callable.call();
+    }
+
     private class MyInnerWithANativeMethod {
 
         public String foo() {



Mime
View raw message