0
我想找一些關於NOSQLUnit-mongoDB.But的例子,但是這個github中的一些資源無法工作。 http://lordofthejars.github.io/nosql-unit/nosqlunit.html 有我的代碼:NOSQLUnit-mongoDB-example
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
}
任何人都可以給我使用MongoDB的有關JUnit的一些例子嗎?
感謝您的回答! – eleforest 2015-06-29 09:04:04