joelkoz wrote: May I point you to the class org.springframework.test.AbstractTransactionalDataSourceSpringContextTests found in the "spring-mock.jar" file. Its used for testing of Spring objects. (end of quote)
And as to save you all a little grief, note that the AbstractTransactionDataSourceSpringContextTests object, by default, opens a transaction, then ROLLS IT BACK at the end of the method. That, combined with some Caching on Hibernate's part was driving me nuts, as I was wondering why things "weren't working." I'd run my test, but only SOME of the Hibernate data would be persisted. The simple solution: 1) call the "setComplete()" method as the last line of your test method if you wish all of the transactions to be committed to the database. Use this if you are testing your unit test (i.e. looking at things running and then looking at the database, vs. creating a final production test runner). Another option: call "setDefaultRollback(false)" somewhere before ANY of your tests are run. This will cause ALL methods in your unit test to committ the transaction, rather than roll them back. Note that for a production unit test, the default behavior is the "right one". It writes to the database, then rolls things back, so the test can be run and re-run. _________________________________________________________ Reply to the post : http://galaxy.andromda.org/forum/viewtopic.php?p=3906#3906 Posting to http://forum.andromda.org/ is preferred over posting to the mailing list! ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Andromda-user mailing list Andromda-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/andromda-user