DatabaseManager implements Closeable { public void clear() { try { getDatabase().delete(mDefaultTable, null, null); } catch (RuntimeException e) { AppCenterLog.error(LOG_TAG, "Failed to clear the table.", e); } } DatabaseManager(Context context, String database, String defaultTable, int version,
                           ContentValues schema, final String sqlCreateCommand, @NonNull Listener listener); ContentValues buildValues(Cursor cursor); @Nullable ContentValues nextValues(Cursor cursor); long put(@NonNull ContentValues values, @NonNull String priorityColumn); void delete(@IntRange(from = 0) long id); int delete(@NonNull String key, @Nullable Object value); void clear(); @Override void close(); final long getRowCount(); Cursor getCursor(@Nullable SQLiteQueryBuilder queryBuilder, String[] columns, @Nullable String[] selectionArgs, @Nullable String sortOrder); boolean setMaxSize(long maxStorageSizeInBytes); long getMaxSize(); static final String PRIMARY_KEY; static final String[] SELECT_PRIMARY_KEY; }
@Test public void clearFailed() { DatabaseManager databaseManagerMock = getDatabaseManagerMock(); databaseManagerMock.clear(); verifyStatic(); AppCenterLog.error(eq(AppCenter.LOG_TAG), anyString(), any(RuntimeException.class)); }