How to use JUnit and Hibernate usefully?
问题 I want to use JUnit to test Hibernate code such as insert, update, delete,.. method and transaction management. But I don't know how to apply unit test for Hibernate usefully and what should I test with Hibernate. How can I test DAO methods? Hope that you could give me some guides! 回答1: You can use DBUnit to test DAO Layer. Because you need data to test. Example : DBUnit xml will insert dummy data to database which is described by you and then you can call assertEquals("myname", userDAO