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 protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
