[jboss-user] [Microcontainer] - Re: Injecting beans into Unit Tests under 1.02

alesj do-not-reply at jboss.com
Thu Sep 27 07:12:40 EDT 2007


"jonesn" wrote : 
  | Is there a way to have beans configured in the context automatically injected into the Tests that need them?
  | 
  | For example you have a base class that extends MicrocontainerTest that loads the contexts. Then any class extending that base class which has a setter matching the name of a bean in the context will automatically be wired using the Microcontatiner managed bean.
  | 

Currently there is no such Test class. We didn't have any need for it. :-)

But I guess you can easily extend the MicrocontainerTest with the mentioned functionality. Simply register the actual Test instance into underlying controller - and pre-annotate it before ;-), and the contextual injection should be there.

If you still have problems, let me know, and I'll hack something up. Or if you already have it, please share it.  :-)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4089267#4089267

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4089267



More information about the jboss-user mailing list