Re: rollbackChanges in a unit test

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Jan 12 2004 - 11:11:02 EST

  • Next message: James Treleaven: "Re: ObjectStore and Caching"

    Jim,

    this is a bug in handling NEW objects deletion. I created a ticket for
    it:

        http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-75

    Working on it now...

    Andrus

    On Jan 12, 2004, at 10:11 AM, Jim Menard wrote:

    > On Jan 12, 2004, at 8:43 AM, I wrote:
    >
    >> I've written a unit test using JUnit. It's throwing a
    >> NullPointerException during the call to context.rollbackChanges().
    >> This only started happening when I added the code after the line "NPE
    >> CAUSED BY THIS CODE?". Does anyone have any suggestions as to what
    >> I'm doing wrong?
    >
    > Another hint: I see the same exception every time in SnapshotManager
    > if I change tearDown() to
    >
    > public void tearDown() {
    > context.deleteObject(metadata);
    > context.rollbackChanges();
    > }
    >
    > Is it wrong to delete objects that have not yet been committed? If so,
    > then how do I test adding and deleting objects from a to-many list in
    > my test code?
    >
    > This isn't just about test code: When a user edits something, I make a
    > deep copy (registered with the context). The user may cause items to
    > be added/deleted from the object's lists of other objects, so I will
    > see the same situation in the code.
    >
    > Jim
    > --
    > Jim Menard, jim..o.com, http://www.io.com/~jimm/
    > "Brought to you again by the Department of Redundancy Department."
    > -- Firesign Theatre
    >
    >



    This archive was generated by hypermail 2.0.0 : Mon Jan 12 2004 - 11:11:08 EST