Re: Dealing with EOUtilities.localInstanceOfObject() in WOUnit
Re: Dealing with EOUtilities.localInstanceOfObject() in WOUnit
- Subject: Re: Dealing with EOUtilities.localInstanceOfObject() in WOUnit
- From: Paul Hoadley <email@hidden>
- Date: Mon, 11 Jul 2011 09:59:58 +0930
On 11/07/2011, at 8:09 AM, Henrique Prange wrote:
> On 10/07/2011, at 08:04, Paul Hoadley wrote:
>
>> Hi Henrique,
>>
>> I'm using WOUnit 1.1.1 to unit test some code that indirectly calls EOUtilities.localInstanceOfObject() for whatever reason on an EO that I've inserted into a MockEditingContext. Because the EO has not been saved to the (non-existent) DB, the local-instance fails and returns null, and I get an NPE. I could certainly set up an in-memory DB using H2, but I'd prefer to avoid the work.
>
> What happen if you call saveChanges in your MockEditingContext before calling the EOUtilities.localInstanceOfObject? AFAIR, calling EOUtilities.localInstanceOfObject on unsaved objects result in null even with real editing contexts.
Oh, sorry—it hadn't even occurred to me to try. I gave up too early. It works just fine.
--
Paul.
http://logicsquad.net/
_______________________________________________
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