/*****************************************************************************
* Copyright (C) PicoContainer Organization. All rights reserved. *
* ------------------------------------------------------------------------- *
* The software in this package is published under the terms of the BSD *
* style license a copy of which has been included with this distribution in *
* the LICENSE.txt file. *
* *
*****************************************************************************/
package tests.jfun.yan;
import jfun.yan.*;
import jfun.yan.containers.DefaultContainer;
import jfun.yan.containers.ProxyContainer;
import junit.framework.TestSuite;
import java.util.List;
import java.util.ArrayList;
public class ProxyContainerTestCase
extends BaseProxyContainerTestCase {
public static void main(String[] args){
tests.jfun.yan.Utils.runTest(suite());
}
private static TestSuite suite(){
return new TestSuite(ProxyContainerTestCase.class);
}
protected Container createImplementationHidingPicoContainer() {
return new ProxyContainer();
}
protected Container createPicoContainer(Container parent) {
return new ProxyContainer().inherit(parent);
}
/*
public void testStartStopAndDisposeNotCascadedtoRemovedChildren() {
super.testStartStopAndDisposeNotCascadedtoRemovedChildren();
}
*/
public static class MyThread extends Thread {
public MyThread(String s){super(s);}
}
/*
public void testHidingWithoutParameter() {
// this was a bug reported by Arnd Kors on 21st Sept on the mail list.
ProxyContainer pico = new ProxyContainer();
pico.registerConstructor(String.class);
pico.registerConstructor(Runnable.class, MyThread.class);
new VerifyingVisitor().traverse(pico);
}*/
public void testUsageOfADifferentComponentAdapterFactory() {
// Jira bug 212
Container parent = new DefaultContainer();
Container pico = new ProxyContainer().inherit(parent);
pico.registerConstructor(List.class, ArrayList.class, null);
List list1 = (List) pico.getInstanceOfType(List.class);
List list2 = (List) pico.getInstanceOfType(List.class);
pico.verify();
assertNotNull(list1);
assertNotNull(list2);
assertFalse(list1 == list2);
}
}