Niclas,

You hit the nail on its head ! MyComp is a class not an interface (duuh,
should program to interfaces not to classes, that will teach me !)

Thanks.
Mansour
:-)


-----Original Message-----
From: Niclas Hedhman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 09, 2004 3:53 PM
To: Avalon framework users
Subject: Re: Unit test cast problem

On Thursday 10 June 2004 03:38, Mansour Raad wrote:

> Additional info:

Thanks, I just composed a fairly long reply, and about to send, when this
came 
in... nevertheless.

> when maven runs the testcase, I can see that it completes successfully its
> incarnation lifecycle. In addition, the following does NOT cause a
problem.
>
>       Object o = resolve("/mycont/mycomp");
>       assertNotNull( o);
>
> However, the following fails:
>
>       assertTrue( o instanceof MyComp);

> In addition (and that is the strangest thing), if I System.out.println(
o),
> I get:
>
>       [EMAIL PROTECTED]

This is more strange than you might think.

MyComp must be an interface, since Merlin injects a dynamic Proxy
implementing 
that interface. ( Could it be that dynamic proxies has a toString() of 
interface+"@"+hashCode() )??

Could you do;

Class cls = o.getClass();
System.out.println( cls.getName() );
Class[] classes = cls.getClasses();
for( int i=0 ; i < classes ; i++ )
    System.out.println( "Declared: " + classes[i] );


Cheers
Niclas

P.S. It is 04:00 am here, and I am really tired, so I won't be able to look
at 
this until tomorrow evening (~12 hours), hope someone else (Steve) can fill 
you in...


-- 
   +------//-------------------+
  / http://www.bali.ac        /
 / http://niclas.hedhman.org / 
+------//-------------------+


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to