I'm looking for the way to initialize my test h2 database with some initial test data from java code for the future tests. But I don't wanna use @Before annotation, because this data will be used in all test cases in all classes. I already found how to do this using SQL files with initial data. But I don't wanna write SQL inserts. It's easier for me to write some java code and then save created objects to the database. Is it possible to do? If yes, show me please how to do that.
As I didn't found answer to my question, it might be a bad idea at all. If yes, explain me why, please?
In my project I'm using Spring data JPA. I'm new with spring integrational testing and only start to work with it.
Aucun commentaire:
Enregistrer un commentaire