I want to write some WOUnit tests for a class that extends ERXPartialGenericRecord—that is, a "base entity" in the partial entities terminology. I have a simple "User" class in a model called "Ident":
public class UserTest {
@Rule
public MockEditingContext ec = new MockEditingContext("Ident");
@Test
public void createUser() {
User u = User.createUser(ec, "password", "username");
confirm(u, canBeSaved());
return;
}
}
java.lang.ClassCastException: com.webobjects.eoaccess.EOEntityClassDescription cannot be cast to er.extensions.eof.ERXEntityClassDescription
at er.extensions.partials.ERXPartialGenericRecord._partialsDictionary(ERXPartialGenericRecord.java:40)
at er.extensions.partials.ERXPartialGenericRecord._partials(ERXPartialGenericRecord.java:64)
at er.extensions.partials.ERXPartialGenericRecord.awakeFromInsertion(ERXPartialGenericRecord.java:179)
at com.webobjects.eocontrol.EOEditingContext.insertObjectWithGlobalID(EOEditingContext.java:2871)
at er.extensions.eof.ERXEC.insertObjectWithGlobalID(ERXEC.java:976)
at com.webobjects.eocontrol.EOEditingContext.insertObject(EOEditingContext.java:2889)
at er.extensions.eof.ERXEC.insertObject(ERXEC.java:987)
at com.webobjects.eoaccess.EOUtilities.createAndInsertInstance(EOUtilities.java:862)
at net.logicsquad.access.model._User.createUser(_User.java:180)
at net.logicsquad.access.tests.UserTest.createUser(UserTest.java:20)
I know you haven't done any testing with partial entities yourself (I spoke to Henrique off-list). Eyeballing it, does this look like an issue with WOUnit, or ERXPartialGenericRecord? I can provide a minimal test project if you need it. Let me know.