I have the following code
Record rd = registerNewRecord();
<do some processing>
rd.setFinished(true);
updateRecord(rd);
The registerNewRecord method calls the RecordDao insert method, and updateRecord calls the update method on the same DAO.
I have the following easymock code:
Capture<Record> insertRc = new Capture<Record>();
RecordDao.insert(capture(insertRc));
Capture<Record> updateRc= new Capture<Record>();
RecordDao.update(capture(updateRc));
Problem is since above rd the same instance of Record that was inserted is being updated, the insertRc Capture object is being updated too. So i cannot assert that the finished flag is set to false at insert time.
What am i doing wrong?