@Test public void upgrade_toANonExistentVersion_fails() { int oldVersion = 1; int nonExistentVersion = 1000; SchemaManager schemaManager = new SchemaManager(ApplicationProvider.getApplicationContext(), DB_NAME, oldVersion); Assert.assertThrows( IllegalArgumentException.class, () -> schemaManager.onUpgrade( schemaManager.getWritableDatabase(), oldVersion, nonExistentVersion)); }
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { ensureConfigured(db); upgrade(db, oldVersion, newVersion); }
SchemaManager extends SQLiteOpenHelper { @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { ensureConfigured(db); upgrade(db, oldVersion, newVersion); } }
SchemaManager extends SQLiteOpenHelper { @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { ensureConfigured(db); upgrade(db, oldVersion, newVersion); } @Inject  SchemaManager(
      Context context,
      @Named("SQLITE_DB_NAME") String dbName,
      @Named("SCHEMA_VERSION") int schemaVersion); }
SchemaManager extends SQLiteOpenHelper { @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { ensureConfigured(db); upgrade(db, oldVersion, newVersion); } @Inject  SchemaManager(
      Context context,
      @Named("SQLITE_DB_NAME") String dbName,
      @Named("SCHEMA_VERSION") int schemaVersion); @Override void onConfigure(SQLiteDatabase db); @Override void onCreate(SQLiteDatabase db); @Override void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion); @Override void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion); @Override void onOpen(SQLiteDatabase db); }
SchemaManager extends SQLiteOpenHelper { @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { ensureConfigured(db); upgrade(db, oldVersion, newVersion); } @Inject  SchemaManager(
      Context context,
      @Named("SQLITE_DB_NAME") String dbName,
      @Named("SCHEMA_VERSION") int schemaVersion); @Override void onConfigure(SQLiteDatabase db); @Override void onCreate(SQLiteDatabase db); @Override void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion); @Override void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion); @Override void onOpen(SQLiteDatabase db);  }