我想找一些关于NOSQLUnit-mongoDB的例子。但是这个github中的一些资源无法工作。http://lordofthejars.github.io/nosql-unit/nosqlunit.html 有我的代码:
public class WhenANewBookIsCreated {
@Rule
public MongoDbRule mongoDbRule = newMongoDbRule().defaultManagedMongoDb("test");
@Test
//@UsingDataSet(locations="initialData.json", loadStrategy=LoadStrategyEnum.CLEAN_INSERT)
@ShouldMatchDataSet(location="expectedData.json")
public void book_should_be_inserted_into_repository() {
WeiboDao wdao = new WeiboDao("test");
Weibo weibo = new Weibo("unitNosql",1);
wdao.save(weibo.toDBObject());
}
}
initialData.json& expectedData.json:
{
"_id" : ObjectId("53ec6b92419d5d941c6ba8a3"),
"content" : "hello",
"type" : "s",
"predictType" : null
}
任何人都可以给我一些使用junit关于mongoDB的例子吗?