jicarilla-sandbox/platform/container/impl/src/test/org/jicarilla/container/test/util Type3UtilTestCase.java,1.2,1.3

Leo Simons <[email protected]>
Newsgroups gmane.comp.java.jicarilla.cvs
Message-ID <[email protected]>
Update of /cvsroot/jicarilla/jicarilla-sandbox/platform/container/impl/src/test/org/jicarilla/container/test/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1730/platform/container/impl/src/test/org/jicarilla/container/test/util

Modified Files:
	Type3UtilTestCase.java 
Log Message:
Start support for overriding specific parts of the autowiring policy

Index: Type3UtilTestCase.java
===================================================================
RCS file: /cvsroot/jicarilla/jicarilla-sandbox/platform/container/impl/src/test/org/jicarilla/container/test/util/Type3UtilTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Type3UtilTestCase.java	23 Mar 2004 13:37:54 -0000	1.2
+++ Type3UtilTestCase.java	23 Mar 2004 14:22:35 -0000	1.3
@@ -28,6 +28,7 @@
 import junit.framework.TestCase;
 import org.jicarilla.container.NoPublicConstructorAvailableException;
 import org.jicarilla.container.NoSatisfiableConstructorAvailableException;
+import org.jicarilla.container.Resolver;
 import org.jicarilla.container.tck.components.interfaces.Bart;
 import org.jicarilla.container.tck.components.interfaces.Homer;
 import org.jicarilla.container.tck.components.interfaces.Marge;
@@ -35,6 +36,7 @@
 import org.jicarilla.container.test.AbstractSimpson_test_case;
 import org.jicarilla.container.util.Type3Util;
 import org.jicarilla.lang.CascadingRuntimeException;
+import org.easymock.MockControl;
 
 import java.lang.reflect.Constructor;
 import java.util.Properties;
@@ -160,6 +162,49 @@
         };
         Type3Util.sortConstructorsByGreediness(weird);
     }
+    
+    public void testNewInstanceGetsParametersInOrderFromResolver()
+            throws Exception
+    {
+        MockControl resolverControl = MockControl.createStrictControl(
+                Resolver.class );
+        Resolver resolver = (Resolver)resolverControl.getMock();
+        
+        String param1 = "1";
+        Class param2 = this.getClass();
+        Properties param3 = System.getProperties();
+        String param4 = "4";
+        String param5 = "5";
+        Integer param6 = new Integer(6);
+        Class param7 = this.getClass();
+        TestCase param8 = this;
+        
+        resolver.get( String.class );
+        resolverControl.setReturnValue( param1 );
+        resolver.get( Class.class );
+        resolverControl.setReturnValue( param2 );
+        resolver.get( Properties.class );
+        resolverControl.setReturnValue( param3 );
+        resolver.get( String.class );
+        resolverControl.setReturnValue( param4 );
+        resolver.get( String.class );
+        resolverControl.setReturnValue( param5 );
+        resolver.get( Integer.class );
+        resolverControl.setReturnValue( param6 );
+        resolver.get( Class.class );
+        resolverControl.setReturnValue( param7 );
+        resolver.get( TestCase.class );
+        resolverControl.setReturnValue( param8 );
+        
+        resolverControl.replay();
+        
+        Object instance =
+                Type3Util.newType3Instance( ManyConstructors.class, longestConstructor,
+                    resolver );
+        assertNotNull( instance );
+        
+        resolverControl.verify();
+    }
 
     static Constructor longestConstructor = null;
     static Constructor emptyConstructor = null;



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.