I wrote an API with Spring+Hibernate+postgres, I have the followinq questions
1) I am trying to unit test my DAOs for CRUD operations. whats the best way to do that, does testing on temporay datastore like H2 be the same?
2) Is there any suggested tutorial to do this?
Please help
You may want to use a Spring profile for testing and just swap your DataSources with a embedded H2 Database that will run only on your test. The Spring reference explains it very well. It is as easy as:
The id attribute will be the id of the bean of type DataSource.
You may want to have scripts to set up test records like in the example.