DataAssociationCursor firstCursor = m_orderAssoc.getLineItems().cursor(); firstCursor.next(); firstCursor.next(); assert("m_orderAssoc.getLineItems() is still at first element after calling next", ! (firstCursor.isFirst() || firstCursor.isBeforeFirst())); DataAssociation items = (DataAssociation) m_orderAssoc.getOrder().get("items"); DataAssociationCursor secondCursor = items.cursor(); assertEquals("Consecutive calls to get returned data associations " + "of different sizes", firstCursor.size(), secondCursor.size()); assert("Items is at position: " + secondCursor.getPosition() + ". It should be before the first position", secondCursor.isBeforeFirst());
     public void testConsecutiveCalls() {         // TODO: Re-enable this test once we figure out how to handle         // having data association iterators           // We move the cursor in lineItems two rows. This makes it         // easy to test that the call to get returns an independent         // DataAssociation.         DataAssociationCursor firstCursor = m_orderAssoc.getLineItems().cursor();         firstCursor.next();         firstCursor.next();         assert("m_orderAssoc.getLineItems() is still at first element after calling next",                ! (firstCursor.isFirst() || firstCursor.isBeforeFirst()));         DataAssociation items = (DataAssociation) m_orderAssoc.getOrder().get("items");         DataAssociationCursor secondCursor = items.cursor();         assertEquals("Consecutive calls to get returned data associations " +                      "of different sizes",                      firstCursor.size(), secondCursor.size());         assert("Items is at position: " + secondCursor.getPosition() +                 ". It should be before the first position",                secondCursor.isBeforeFirst());         firstCursor.close();         secondCursor.close();     }