Yes I do that (I use initEOF though), otherwise I couldn't test any EOs.

On 09.08.2010, at 11:23, Denis Frolov wrote:

> I think this can happen if you are not initializing your app before
> running test. If you are using Wonder, you should have something like:
> 
>       @BeforeClass
>       public static void init() {
>               ERXExtensions.initApp(Application.class, new String[0]);
>       }
> 
> in your test class.
> 
> - Denis
> 
> On Mon, Aug 9, 2010 at 1:05 PM, Marius Soutier
> <[email protected]> wrote:
>> Hello,
>> 
>> time and time again I run into this weird error when running my unit tests:
>> 
>> com.webobjects.foundation.NSForwardException 
>> [java.lang.reflect.InvocationTargetException] 
>> null:java.lang.reflect.InvocationTargetException
>>        at 
>> com.webobjects.foundation._NSUtilities._explainInstantiationException(_NSUtilities.java:626)
>>        at 
>> com.webobjects.foundation._NSUtilities.instantiateObjectWithConstructor(_NSUtilities.java:665)
>>        at 
>> com.webobjects.eoaccess.EOEntityClassDescription.createInstanceWithEditingContext(EOEntityClassDescription.java:242)
>>        at 
>> com.webobjects.eoaccess.EOUtilities.createAndInsertInstance(EOUtilities.java:861)
>>        at 
>> net.starhealthcare.sffoundation.model.base._SFPatient.createSFPatient(_SFPatient.java:578)
>>        at 
>> net.starhealthcare.sffoundation.test.SFModelTestCase.initDemoPatient(SFModelTestCase.java:88)
>>        at 
>> net.starhealthcare.sffoundation.test.SFModelTestCase.initTestCase(SFModelTestCase.java:60)
>>        ...
>> Caused by: java.lang.reflect.InvocationTargetException
>>        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
>> Method)
>>        at 
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>>        at 
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>>        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>        at 
>> com.webobjects.foundation._NSUtilities.instantiateObjectWithConstructor(_NSUtilities.java:659)
>>        ... 20 more
>> Caused by: java.lang.NullPointerException
>>        at 
>> com.webobjects.eoaccess.EOModel.createPrototypeCache(EOModel.java:631)
>>        at 
>> com.webobjects.eoaccess.EOModel.prototypeAttributeNamed(EOModel.java:699)
>>        at 
>> com.webobjects.eoaccess.ERXModel.prototypeAttributeNamed(ERXModel.java:315)
>>        at com.webobjects.eoaccess.EOAttribute.<init>(EOAttribute.java:998)
>>        at com.webobjects.eoaccess.EOEntity.attributes(EOEntity.java:816)
>>        at com.webobjects.eoaccess.EOEntity.attributeNamed(EOEntity.java:789)
>>        at 
>> com.webobjects.eoaccess.EOEntity.classProperties(EOEntity.java:1098)
>>        at 
>> com.webobjects.eoaccess.EOEntity._propertyDictionaryInitializer(EOEntity.java:3321)
>>        at 
>> com.webobjects.eoaccess.EOEntity._newDictionaryForProperties(EOEntity.java:3667)
>>        at 
>> com.webobjects.eoaccess.EOEntityClassDescription._newDictionaryForProperties(EOEntityClassDescription.java:88)
>>        at 
>> com.webobjects.eocontrol.EOGenericRecord.__setClassDescription(EOGenericRecord.java:111)
>>        at 
>> com.webobjects.eocontrol.EOGenericRecord.__setClassDescription(EOGenericRecord.java:100)
>>        at 
>> com.webobjects.eocontrol.EOGenericRecord.<init>(EOGenericRecord.java:73)
>>        at er.extensions.eof.ERXGenericRecord.<init>(ERXGenericRecord.java:98)
>>        at 
>> net.starhealthcare.sffoundation.model.SFGenericRecord.<init>(SFGenericRecord.java:16)
>>        at 
>> net.starhealthcare.sffoundation.model.base._SFActor.<init>(_SFActor.java:15)
>>        at 
>> net.starhealthcare.sffoundation.model.SFActor.<init>(SFActor.java:18)
>>        at 
>> net.starhealthcare.sffoundation.model.base._SFPerson.<init>(_SFPerson.java:15)
>>        at 
>> net.starhealthcare.sffoundation.model.SFPerson.<init>(SFPerson.java:12)
>>        at 
>> net.starhealthcare.sffoundation.model.base._SFExternalPerson.<init>(_SFExternalPerson.java:15)
>>        at 
>> net.starhealthcare.sffoundation.model.SFExternalPerson.<init>(SFExternalPerson.java:14)
>>        at 
>> net.starhealthcare.sffoundation.model.base._SFPatient.<init>(_SFPatient.java:15)
>>        at 
>> net.starhealthcare.sffoundation.model.SFPatient.<init>(SFPatient.java:49)
>>        ... 25 more
>> 
>> This happens before any of the tests actually run, in a static @BeforeClass 
>> init() method. I'm using H2 in in-memory mode as a db. Any idea what could 
>> be causing this?
>> 
>> 
>> Thanks,
>> - Marius
>> 
>> 
>>  _______________________________________________
>> 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/dfrolov%40demax.ru
>> 
>> This email sent to [email protected]
>> 
> _______________________________________________
> 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/m.soutier%40starhealthcare.info
> 
> This email sent to [email protected]


 _______________________________________________
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]

Reply via email to