Question

I have a Spring-based webapp and I am using Fongo for some of my Junit tests. This did the trick so far but now I would like to set my database into a concrete context before executing them (by loading, for instance, a .json file beforehand into a concrete collection) and it turns out not to be possible using Fongo. What do you use normally? Is it actually possible? Are there out other possible options? I also heard of EmbedMongo but I am not sure this works with Spring Data repositories, which is what I am using in the persistence layer.

Thanks in advance!

Was it helpful?

Solution 2

I ended up using this Maven plugin. It allows populate/update your Mongo database before running your unit tests (it is a Maven plugin). It is probably not the best option but it did at least the trick for me.

OTHER TIPS

I use JUnit 4 and Spring Data's mongoTemplate. Take a look at my answer to a similar question.

I hope it helps you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top