Hello,

I have an EO class that has an object provided by an @Inject annotation, and it 
wants to use that object in init(). This works just fine in the context of a 
running InjectableApplication. No matter what I try, though, I can’t get the EO 
created in the context of a WOUnit test. What I’ve done in another project is 
to manually create an Injector in a @Before method, and then call 
injector.injectMembers() on the EO. But the EO needs to exist, and to create it 
I need the injected object—chicken and egg.

I’ve come up with a workaround (where init() asks for the object via an 
accessor method which provides a “test version” of it if injection hasn’t 
occurred), but it’s a bit of a hack. There must be a better way. Henrique, are 
you around?


-- 
Paul Hoadley
https://logicsquad.net/
https://www.linkedin.com/company/logic-squad/


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to