1 /****************************************************************************** 2 * Copyright (C) PicoContainer Organization. All rights reserved. * 3 * ------------------------------------------------------------------------- * 4 * The software in this package is published under the terms of the BSD * 5 * style license a copy of which has been included with this distribution in * 6 * the LICENSE.txt file. * 7 * * 8 * Idea by Rachel Davies, Original code by Aslak Hellesoy and Paul Hammant * 9 *****************************************************************************/ 10 11 package picocontainer.hierarchical; 12 13 import junit.framework.TestCase; 14 15 import java.util.List; 16 import java.util.ArrayList; 17 import java.lang.reflect.Constructor; 18 import java.lang.reflect.InvocationTargetException; 19 20 import picocontainer.hierarchical.ImplementationHidingComponentFactory; 21 import picocontainer.PicoInvocationTargetInitailizationException; 22 23 public class ImplementationHidingComponentFactoryTestCase extends TestCase { 24 25 public void testBasic() throws NoSuchMethodException, PicoInvocationTargetInitailizationException { 26 ImplementationHidingComponentFactory cf = new ImplementationHidingComponentFactory(); 27 Constructor ctor = ArrayList.class.getConstructor(new Class[0]); 28 Object o = cf.createComponent(List.class, ctor, new Object[0]); 29 assertTrue(o instanceof List); 30 assertFalse(o instanceof ArrayList); 31 ((List) o).add("hello"); 32 } 33 34 }

This page was automatically generated by Maven