I have a test that succeed sometime and fail other times. If I run the jUnit source that contain this test, it fail sometime in the loadPermission() method. I have no idea where to look at. It is even more strange that sometime, I can have 6 successful tests and after 4 failed in a row.
These test are inside a framework project. When I run the tests, I have these lines on the console but they do not seems to cause problem with the about 100 others tests in the project.
- The EOModel 'erprototypes' has an empty connection dictionary.
- The EOModel 'erprototypes' has an empty connection dictionary.
- The EOModel 'KAAccessControl' has an empty connection dictionary.
- The EOModel 'KAAccessControl' has an empty connection dictionary.
- The model 'KAAccessControl' (path: file:/Users/sam/work/KavijuWO/KAAccessControl/Resources/KAAccessControl.eomodeld) cannot be added to model group <EOModelGroup (("KAAccessControl", "file:/Users/sam/work/KavijuWO/KAAccessControl/Resources/KAAccessControl.eomodeld"), ("erprototypes", "file:/Users/sam/work/WonderSource/Frameworks/Core/ERPrototypes/Resources/erprototypes.eomodeld"))> because it already contains a model with that name.
RolesFileLoader load a plist file to create and update objects in the database.
@Rule public MockEditingContext ec = new MockEditingContext();
@Before
public void loadPermissions() {
ERXProperties.setStringForKey("SampleRolesFile", RolesFileLoader.rolesFileNamePropertyKey);
RolesFileLoader.loadRolesFile(ec);
}
@Test
public void testReloadPermissions() {
ERXProperties.setStringForKey("SampleRolesFile", RolesFileLoader.rolesFileNamePropertyKey);
RolesFileLoader.loadRolesFile(ec);
}
com.webobjects.foundation.NSForwardException [java.lang.reflect.InvocationTargetException] null:java.lang.reflect.InvocationTargetException
…
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)
... 32 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:290)
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:106)
at com.kaviju.accesscontrol.model.base._KAAccessList.<init>(_KAAccessList.java:15)
at com.kaviju.accesscontrol.model.KAAccessList.<init>(KAAccessList.java:8)
... 37 more