當我運行我的測試時,所有的東西都保存在我的sqllite數據庫中,所以我想在我的Junit測試完成後回滾我的Android數據庫,這可能嗎?android testcase junit rollback
protected void setUp() throws Exception {
super.setUp();
Log.i(TAG, Utils.getMethodName() + "entry ");
sdbApp = (SdbApplication) getContext().getApplicationContext();
mContext = getContext();
mProvider = new SdbContentProvider();
mProvider.attachInfo(mContext, null);
mMockContentResolver = new MockContentResolver();
// Create the authority for the URI, by removing the 'content://' and
// any
// '/' or path part after that.
String authority = SpaceDB.CONTENT_URI.toString().substring(10);
int pos = authority.indexOf('/');
if (pos > -1) {
authority = authority.substring(0, pos);
}
mMockContentResolver.addProvider(authority, mProvider);
authority = FolderDB.CONTENT_URI.toString().substring(10);
pos = authority.indexOf('/');
if (pos > -1) {
authority = authority.substring(0, pos);
}
mMockContentResolver.addProvider(authority, mProvider);
this.setContext(new IsolatedContext(mMockContentResolver, mContext));
Thread.sleep(5000);
}
不應該這幫我這個嗎?