Spring/Hibernate testing: Inserting test data after DDL creation

后端 未结 3 396
北海茫月
北海茫月 2021-01-31 00:10

I have a Spring/Hibernate webapp that has some integration tests that run on an in-memory HSQL database. Hibernate takes this blank database and creates all of my test tables a

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-31 00:20

    If you're talking about JUnit tests and using AbstractTransactionalDataSourceSpringContextTests there's methods you can override like onSetupBeforeTransaction that provide a hook to pre-populate test table data etc.

提交回复
热议问题