Spring DATA Mongo. Testing your mongo using in-memory db

######Embeddable
When I was a bit younger, I couldn’t understand why more senior engineers stood for embedding builds as much as it’s possible. For instance, you have a database, and you’re running your integration tests only with in memory databases. It was very unusual for me, why having a working database on your local machine, you’re using some weird in memory things ? The time have passed, and I understand now, that embedding your builds is a good practice, because:

It reduce your build time

It decouples your build phase from any environments

Even if you don’t have any database/thirdparty tool installed on your local machine, your build will finish successfully, and after then you can start installing all required third party instruments.

Fongo + NoSQl-Unit

By this article I’d like to show how to effectively test your Spring DATA repositories using Fongo - an in-memory implementation.

I’m not going to explain how Spring Data works, you can read their documentation here

By adding this line you’re making sure, that you can use NoSQL-Unit. I mean, adding this line will allow you to use
@UsingDataSet annotation. Of course, you can use Fongo without NoSQL-Unit. In this case you will need to manually add records into your nosql storage. Refer to github of following project to understand all possibilities of this project.