WOInject and WOUnit co-operation
WOInject and WOUnit co-operation
- Subject: WOInject and WOUnit co-operation
- From: Paul Hoadley <email@hidden>
- Date: Mon, 4 Dec 2017 15:39:48 +1030
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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden