Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassCastException when testing partial entities #32

Closed
paulhoadley opened this issue Aug 15, 2013 · 2 comments
Closed

ClassCastException when testing partial entities #32

paulhoadley opened this issue Aug 15, 2013 · 2 comments
Assignees
Labels
Milestone

Comments

@paulhoadley
Copy link

(Henrique, this is just a placeholder issue for completeness. I know you're all over this, and the fix in your 1.3-SNAPSHOT-partials-fix worked.)

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;
    }
}

This test fails with the following (abridged) stack trace:

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)
@paulhoadley
Copy link
Author

ad75034 fixes this issue.

@hprange
Copy link
Owner

hprange commented Feb 22, 2014

I'm going to release WOUnit 1.2.3 this afternoon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants