Re: [picocontainer-dev] Bug or feature?
Paul Hammant <[email protected]>
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
I'm assuming both testcases were for the trunk ..
Your second case I had to correct to -
MutablePicoContainer parent =
createPicoContainer(null);
MutablePicoContainer child =
createPicoContainer(parent);
ComponentC parentC = new ComponentC();
ComponentC childC = new ComponentC();
parent.addComponent(ComponentA.class);
parent.addComponent(ComponentB.class);
parent.addComponent(ComponentC.class, parentC);
child.addComponent(ComponentC.class, childC);
assertNotNull(child.getComponent(ComponentA.class));
assertSame(parentC, child.getComponent
(ComponentA.class).c); // add a pub final field c for ComponentC
... as running it as you had it yielded :-
java.lang.ClassCastException: java.lang.String is not a
org.picocontainer.tck.AbstractPicoContainerTestCase$ComponentC
at org.picocontainer.adapters.AbstractAdapter.checkTypeCompatibility
(AbstractAdapter.java:90)
at org.picocontainer.adapters.AbstractAdapter.<init>
(AbstractAdapter.java:64)
So in my version of the second test case in DPCTC, The contentious
issue is whether ComponentA's member reference to ComponentC should
be from the parent container or the chid container.
It is from the parent container presently.
- Paul
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email