KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nanocontainer > aop > dynaop > PicoContainerProxyTestCase


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 various *
9  *****************************************************************************/

10 package org.nanocontainer.aop.dynaop;
11
12 import junit.framework.TestCase;
13 import org.picocontainer.MutablePicoContainer;
14 import org.picocontainer.PicoContainer;
15 import org.picocontainer.defaults.DefaultPicoContainer;
16
17 /**
18  * @author Stephen Molitor
19  */

20 public class PicoContainerProxyTestCase extends TestCase {
21
22     private MutablePicoContainer container = new DefaultPicoContainer();
23     private ContainerLoader containerLoader = new ContainerLoader();
24
25     public void testProxy() {
26         PicoContainer proxy = PicoContainerProxy.create(containerLoader);
27         containerLoader.setContainer(container);
28
29         container.registerComponentInstance("key", "instance");
30         assertEquals("instance", proxy.getComponentInstance("key"));
31     }
32
33 }
34
Popular Tags