mardi 24 avril 2018

Spring MongoDB, clean up DB between tests

I have a spring boot app that uses MongoDB. In my test configuration I am creating a Fongo instance by extending AbstractMongoConfiguration (hence a new instance of Fongo is not being created for each test). I would like an automated way of resetting the Fongo DB without reloading the entire Spring context. I know I could use DirtiesContext but I don't want the overhead of reloading the entire Spring context (especially in a web-app) just to empty a few DB collections.

Aucun commentaire:

Enregistrer un commentaire