What’s the strategy to recover data during DAO unit test?

Posted by Michael Lu on Stack Overflow See other posts from Stack Overflow or by Michael Lu
Published on 2010-04-06T09:16:39Z Indexed on 2010/04/06 9:33 UTC
Read the original article Hit count: 523

Filed under:
|
|
|

When I test DAO module in JUnit, an obvious problem is: how to recover testing data in database? For instance, a record should be deleted in both test methods testA() and testB(), that means precondition of both test methods need an existing record to be deleted. Then my strategy is inserting the record in setUp() method to recover data.

What’s your better solution? Or your practical idea in such case? Thanks

© Stack Overflow or respective owner

Related posts about junit

Related posts about dao