https://github.com/fakemongo/fongo
Maven Dependency
<dependency><groupId>com.github.fakemongo</groupId>
<artifactId>fongo</artifactId>
<version>2.0.4</version>
<scope>test</scope>
</dependency>
Example
Now just inject an instance of Fongo anywhere that a MongoClient would have been used.final Fongo fakeMongo = new Fongo("FakeMongo");
final MongoClient mongoClient = fakeMongo.getMongo();
Now just interact with the mongoClient as normal. Add documents, delete, read etc
No comments:
Post a Comment