use of android.test.mock.MockContentProvider in project tray by grandcentrix.
the class TrayTest method testClearAllFails.
public void testClearAllFails() throws Exception {
final MockContentProvider mockContentProvider = new MockContentProvider(getProviderMockContext()) {
@Override
public int delete(final Uri uri, final String selection, final String[] selectionArgs) {
throw new IllegalStateException("something serious is wrong");
}
};
getProviderMockContext().addProvider(MockProvider.AUTHORITY, mockContentProvider);
getProviderMockContext().enableMockResolver(true);
final Tray tray = new Tray(getProviderMockContext());
final TestTrayModulePreferences module2 = new TestTrayModulePreferences(getProviderMockContext(), "module2");
module2.put("blubb", "hello");
mTrayModulePref.put("test", "test");
assertUserDatabaseSize(2);
assertFalse(tray.clear());
assertUserDatabaseSize(2);
}
Aggregations