I am using fongo as in memory database for testing my mongodbrepository.
I have taken reference from http://dontpanic.42.nl/2015/02/in-memory-mongodb-for-unit-and.html for unit testing.
To populate sample data, I have added required json file under test/resources/json-data/user/user.json but it's not loaded into fongo.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.CLEAN_INSERT, locations = "/json-data/user/user.json") // test/resources/..
public void findUser_should_return_user() {
User user = userRepository.findByXYZId("XX12345");
assertNotNull(user);
}
What's missing ? What needs to change to load dataset from json to fongo(fake mongo)
[Edit-1] Need to try 2 things #1 Include missing rule & #2 json format
looks like json format need to include collection name - Reference-1 : https://github.com/lordofthejars/nosql-unit#dataset-format
Reference 2 -https://github.com/lordofthejars/nosql-unit/tree/master/nosqlunit-demo/src/test/resources/com/lordofthejars/nosqlunit/demo/mongodb