@Test public void onCreate() { final TableDefaultsCustomizer customizer = mock(TableDefaultsCustomizer.class); mPaymentMethodsTable.onCreate(mSQLiteDatabase, customizer); verify(mSQLiteDatabase, atLeastOnce()).execSQL(mSqlCaptor.capture()); verify(customizer).insertPaymentMethodDefaults(mPaymentMethodsTable); final String creatingTable = mSqlCaptor.getValue(); assertTrue(creatingTable.contains("CREATE TABLE paymentmethods")); assertTrue(creatingTable.contains("id INTEGER PRIMARY KEY AUTOINCREMENT")); assertTrue(creatingTable.contains("method TEXT")); assertTrue(creatingTable.contains("drive_sync_id TEXT")); assertTrue(creatingTable.contains("drive_is_synced BOOLEAN DEFAULT 0")); assertTrue(creatingTable.contains("drive_marked_for_deletion BOOLEAN DEFAULT 0")); assertTrue(creatingTable.contains("last_local_modification_time DATE")); assertTrue(creatingTable.contains("custom_order_id INTEGER DEFAULT 0")); assertTrue(creatingTable.contains("uuid TEXT")); assertTrue(creatingTable.contains("expenseable BOOLEAN DEFAULT 0")); }
@Override public synchronized void onCreate(@NonNull SQLiteDatabase db, @NonNull TableDefaultsCustomizer customizer) { super.onCreate(db, customizer); final String sql = "CREATE TABLE " + getTableName() + " (" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COLUMN_METHOD + " TEXT, " + COLUMN_REIMBURSABLE + " BOOLEAN DEFAULT 0, " + AbstractSqlTable.COLUMN_DRIVE_SYNC_ID + " TEXT, " + AbstractSqlTable.COLUMN_DRIVE_IS_SYNCED + " BOOLEAN DEFAULT 0, " + AbstractSqlTable.COLUMN_DRIVE_MARKED_FOR_DELETION + " BOOLEAN DEFAULT 0, " + AbstractSqlTable.COLUMN_LAST_LOCAL_MODIFICATION_TIME + " DATE, " + AbstractSqlTable.COLUMN_CUSTOM_ORDER_ID + " INTEGER DEFAULT 0, " + AbstractSqlTable.COLUMN_UUID + " TEXT " + ");"; Logger.debug(this, sql); db.execSQL(sql); customizer.insertPaymentMethodDefaults(this); }
PaymentMethodsTable extends AbstractSqlTable<PaymentMethod> { @Override public synchronized void onCreate(@NonNull SQLiteDatabase db, @NonNull TableDefaultsCustomizer customizer) { super.onCreate(db, customizer); final String sql = "CREATE TABLE " + getTableName() + " (" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COLUMN_METHOD + " TEXT, " + COLUMN_REIMBURSABLE + " BOOLEAN DEFAULT 0, " + AbstractSqlTable.COLUMN_DRIVE_SYNC_ID + " TEXT, " + AbstractSqlTable.COLUMN_DRIVE_IS_SYNCED + " BOOLEAN DEFAULT 0, " + AbstractSqlTable.COLUMN_DRIVE_MARKED_FOR_DELETION + " BOOLEAN DEFAULT 0, " + AbstractSqlTable.COLUMN_LAST_LOCAL_MODIFICATION_TIME + " DATE, " + AbstractSqlTable.COLUMN_CUSTOM_ORDER_ID + " INTEGER DEFAULT 0, " + AbstractSqlTable.COLUMN_UUID + " TEXT " + ");"; Logger.debug(this, sql); db.execSQL(sql); customizer.insertPaymentMethodDefaults(this); } }
PaymentMethodsTable extends AbstractSqlTable<PaymentMethod> { @Override public synchronized void onCreate(@NonNull SQLiteDatabase db, @NonNull TableDefaultsCustomizer customizer) { super.onCreate(db, customizer); final String sql = "CREATE TABLE " + getTableName() + " (" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COLUMN_METHOD + " TEXT, " + COLUMN_REIMBURSABLE + " BOOLEAN DEFAULT 0, " + AbstractSqlTable.COLUMN_DRIVE_SYNC_ID + " TEXT, " + AbstractSqlTable.COLUMN_DRIVE_IS_SYNCED + " BOOLEAN DEFAULT 0, " + AbstractSqlTable.COLUMN_DRIVE_MARKED_FOR_DELETION + " BOOLEAN DEFAULT 0, " + AbstractSqlTable.COLUMN_LAST_LOCAL_MODIFICATION_TIME + " DATE, " + AbstractSqlTable.COLUMN_CUSTOM_ORDER_ID + " INTEGER DEFAULT 0, " + AbstractSqlTable.COLUMN_UUID + " TEXT " + ");"; Logger.debug(this, sql); db.execSQL(sql); customizer.insertPaymentMethodDefaults(this); } PaymentMethodsTable(@NonNull SQLiteOpenHelper sqLiteOpenHelper,
                               @NonNull OrderingPreferencesManager orderingPreferencesManager); }
PaymentMethodsTable extends AbstractSqlTable<PaymentMethod> { @Override public synchronized void onCreate(@NonNull SQLiteDatabase db, @NonNull TableDefaultsCustomizer customizer) { super.onCreate(db, customizer); final String sql = "CREATE TABLE " + getTableName() + " (" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COLUMN_METHOD + " TEXT, " + COLUMN_REIMBURSABLE + " BOOLEAN DEFAULT 0, " + AbstractSqlTable.COLUMN_DRIVE_SYNC_ID + " TEXT, " + AbstractSqlTable.COLUMN_DRIVE_IS_SYNCED + " BOOLEAN DEFAULT 0, " + AbstractSqlTable.COLUMN_DRIVE_MARKED_FOR_DELETION + " BOOLEAN DEFAULT 0, " + AbstractSqlTable.COLUMN_LAST_LOCAL_MODIFICATION_TIME + " DATE, " + AbstractSqlTable.COLUMN_CUSTOM_ORDER_ID + " INTEGER DEFAULT 0, " + AbstractSqlTable.COLUMN_UUID + " TEXT " + ");"; Logger.debug(this, sql); db.execSQL(sql); customizer.insertPaymentMethodDefaults(this); } PaymentMethodsTable(@NonNull SQLiteOpenHelper sqLiteOpenHelper,
                               @NonNull OrderingPreferencesManager orderingPreferencesManager); @Override synchronized void onCreate(@NonNull SQLiteDatabase db, @NonNull TableDefaultsCustomizer customizer); @Override synchronized void onUpgrade(@NonNull SQLiteDatabase db, int oldVersion, int newVersion, @NonNull TableDefaultsCustomizer customizer); }
PaymentMethodsTable extends AbstractSqlTable<PaymentMethod> { @Override public synchronized void onCreate(@NonNull SQLiteDatabase db, @NonNull TableDefaultsCustomizer customizer) { super.onCreate(db, customizer); final String sql = "CREATE TABLE " + getTableName() + " (" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COLUMN_METHOD + " TEXT, " + COLUMN_REIMBURSABLE + " BOOLEAN DEFAULT 0, " + AbstractSqlTable.COLUMN_DRIVE_SYNC_ID + " TEXT, " + AbstractSqlTable.COLUMN_DRIVE_IS_SYNCED + " BOOLEAN DEFAULT 0, " + AbstractSqlTable.COLUMN_DRIVE_MARKED_FOR_DELETION + " BOOLEAN DEFAULT 0, " + AbstractSqlTable.COLUMN_LAST_LOCAL_MODIFICATION_TIME + " DATE, " + AbstractSqlTable.COLUMN_CUSTOM_ORDER_ID + " INTEGER DEFAULT 0, " + AbstractSqlTable.COLUMN_UUID + " TEXT " + ");"; Logger.debug(this, sql); db.execSQL(sql); customizer.insertPaymentMethodDefaults(this); } PaymentMethodsTable(@NonNull SQLiteOpenHelper sqLiteOpenHelper,
                               @NonNull OrderingPreferencesManager orderingPreferencesManager); @Override synchronized void onCreate(@NonNull SQLiteDatabase db, @NonNull TableDefaultsCustomizer customizer); @Override synchronized void onUpgrade(@NonNull SQLiteDatabase db, int oldVersion, int newVersion, @NonNull TableDefaultsCustomizer customizer); static final String TABLE_NAME; static final String COLUMN_METHOD; static final String COLUMN_REIMBURSABLE; }