VersionTable { @VisibleForTesting static boolean tableExists(SQLiteDatabase readableDatabase, String tableName) { long count = DatabaseUtils.queryNumEntries( readableDatabase, "sqlite_master", "tbl_name = ?", new String[] {tableName}); return count > 0; } private  VersionTable(); static void setVersion(
      SQLiteDatabase writableDatabase, @Feature int feature, String instanceUid, int version); static void removeVersion(
      SQLiteDatabase writableDatabase, @Feature int feature, String instanceUid); static int getVersion(SQLiteDatabase database, @Feature int feature, String instanceUid); static final int VERSION_UNSET; static final int FEATURE_OFFLINE; static final int FEATURE_CACHE_CONTENT_METADATA; static final int FEATURE_CACHE_FILE_METADATA; }
@Test public void doesTableExist_nonExistingTable_returnsFalse() { assertThat(VersionTable.tableExists(database, "NonExistingTable")).isFalse(); }
@Test public void doesTableExist_existingTable_returnsTrue() { String table = "TestTable"; databaseProvider.getWritableDatabase().execSQL("CREATE TABLE " + table + " (dummy INTEGER)"); assertThat(VersionTable.tableExists(database, table)).isTrue(); }