@Test public void testOnUpgrade() { Context context; GsonSerializationStrategy<Data, Batch<Data>> gsonSerializationStrategy; gsonSerializationStrategy = new GsonSerializationStrategy<>(); gsonSerializationStrategy.build(); context = RuntimeEnvironment.application; DatabaseHelper databaseHelper = new DatabaseHelper<>(gsonSerializationStrategy, "test", context); SQLiteDatabase db = databaseHelper.getReadableDatabase(); databaseHelper.onUpgrade(db, 1, 2); }
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_EVENT_DATA); onCreate(db); }
DatabaseHelper extends SQLiteOpenHelper { @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_EVENT_DATA); onCreate(db); } }
DatabaseHelper extends SQLiteOpenHelper { @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_EVENT_DATA); onCreate(db); } DatabaseHelper(SerializationStrategy<E, T> serializationStrategy, String databaseName, Context context); }
DatabaseHelper extends SQLiteOpenHelper { @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_EVENT_DATA); onCreate(db); } DatabaseHelper(SerializationStrategy<E, T> serializationStrategy, String databaseName, Context context); @Override void onCreate(SQLiteDatabase db); @Override void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion); void addData(Collection<E> dataCollection); Collection<E> getAllData(); void deleteDataList(Collection<E> dataCollection); void deleteAll(); boolean isDataInDB(String id); }
DatabaseHelper extends SQLiteOpenHelper { @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_EVENT_DATA); onCreate(db); } DatabaseHelper(SerializationStrategy<E, T> serializationStrategy, String databaseName, Context context); @Override void onCreate(SQLiteDatabase db); @Override void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion); void addData(Collection<E> dataCollection); Collection<E> getAllData(); void deleteDataList(Collection<E> dataCollection); void deleteAll(); boolean isDataInDB(String id);  }