ReceiptsTable extends TripForeignKeyAbstractSqlTable<Receipt> { @Override public synchronized void onCreate(@NonNull SQLiteDatabase db, @NonNull TableDefaultsCustomizer customizer) { super.onCreate(db, customizer); final String receipts = "CREATE TABLE " + ReceiptsTable.TABLE_NAME + " (" + ReceiptsTable.COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + ReceiptsTable.COLUMN_PATH + " TEXT, " + ReceiptsTable.COLUMN_PARENT_TRIP_ID + " INTEGER REFERENCES " + TripsTable.TABLE_NAME + " ON DELETE CASCADE, " + ReceiptsTable.COLUMN_NAME + " TEXT DEFAULT \"New Receipt\", " + ReceiptsTable.COLUMN_CATEGORY_ID + " INTEGER REFERENCES " + CategoriesTable.TABLE_NAME + " ON DELETE NO ACTION, " + ReceiptsTable.COLUMN_DATE + " DATE DEFAULT (DATE('now', 'localtime')), " + ReceiptsTable.COLUMN_TIMEZONE + " TEXT, " + ReceiptsTable.COLUMN_COMMENT + " TEXT, " + ReceiptsTable.COLUMN_ISO4217 + " TEXT NOT NULL, " + ReceiptsTable.COLUMN_PRICE + " DECIMAL(10, 2) DEFAULT 0.00, " + ReceiptsTable.COLUMN_TAX + " DECIMAL(10, 2) DEFAULT 0.00, " + ReceiptsTable.COLUMN_TAX2 + " DECIMAL(10, 2) DEFAULT 0.00, " + ReceiptsTable.COLUMN_EXCHANGE_RATE + " DECIMAL(10, 10) DEFAULT -1.00, " + ReceiptsTable.COLUMN_PAYMENT_METHOD_ID + " INTEGER REFERENCES " + PaymentMethodsTable.TABLE_NAME + " ON DELETE NO ACTION, " + ReceiptsTable.COLUMN_REIMBURSABLE + " BOOLEAN DEFAULT 1, " + ReceiptsTable.COLUMN_NOTFULLPAGEIMAGE + " BOOLEAN DEFAULT 1, " + ReceiptsTable.COLUMN_PROCESSING_STATUS + " TEXT, " + ReceiptsTable.COLUMN_NAME_HIDDEN_AUTO_COMPLETE + " BOOLEAN DEFAULT 0, " + ReceiptsTable.COLUMN_COMMENT_HIDDEN_AUTO_COMPLETE + " BOOLEAN DEFAULT 0, " + ReceiptsTable.COLUMN_EXTRA_EDITTEXT_1 + " TEXT, " + ReceiptsTable.COLUMN_EXTRA_EDITTEXT_2 + " TEXT, " + ReceiptsTable.COLUMN_EXTRA_EDITTEXT_3 + " TEXT, " + 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, receipts); db.execSQL(receipts); } ReceiptsTable(@NonNull SQLiteOpenHelper sqLiteOpenHelper,
                         @NonNull Table<Trip> tripsTable,
                         @NonNull Table<PaymentMethod> paymentMethodTable,
                         @NonNull Table<Category> categoryTable,
                         @NonNull StorageManager storageManager,
                         @NonNull UserPreferenceManager preferences,
                         @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); @Override synchronized Optional<Receipt> deleteBlocking(@NonNull Receipt receipt, @NonNull DatabaseOperationMetadata databaseOperationMetadata); static final String TABLE_NAME; static final String COLUMN_PATH; static final String COLUMN_NAME; static final String COLUMN_PARENT_TRIP_ID; static final String COLUMN_CATEGORY_ID; static final String COLUMN_PRICE; static final String COLUMN_TAX; static final String COLUMN_TAX2; static final String COLUMN_EXCHANGE_RATE; static final String COLUMN_DATE; static final String COLUMN_TIMEZONE; static final String COLUMN_COMMENT; static final String COLUMN_REIMBURSABLE; static final String COLUMN_ISO4217; static final String COLUMN_PAYMENT_METHOD_ID; static final String COLUMN_NOTFULLPAGEIMAGE; static final String COLUMN_PROCESSING_STATUS; static final String COLUMN_NAME_HIDDEN_AUTO_COMPLETE; static final String COLUMN_COMMENT_HIDDEN_AUTO_COMPLETE; static final String COLUMN_EXTRA_EDITTEXT_1; static final String COLUMN_EXTRA_EDITTEXT_2; static final String COLUMN_EXTRA_EDITTEXT_3; @Deprecated
    static final String COLUMN_PARENT; }
@Test public void onCreate() { final TableDefaultsCustomizer customizer = mock(TableDefaultsCustomizer.class); mReceiptsTable.onCreate(mSQLiteDatabase, customizer); verify(mSQLiteDatabase).execSQL(mSqlCaptor.capture()); verifyZeroInteractions(customizer); final String creatingTable = mSqlCaptor.getValue(); assertTrue(creatingTable.contains("CREATE TABLE receipts")); assertTrue(creatingTable.contains("id INTEGER PRIMARY KEY AUTOINCREMENT")); assertTrue(creatingTable.contains("path TEXT")); assertTrue(creatingTable.contains("name TEXT")); assertTrue(creatingTable.contains("parentKey INTEGER")); assertTrue(creatingTable.contains("categoryKey INTEGER")); assertTrue(creatingTable.contains("price DECIMAL(10, 2)")); assertTrue(creatingTable.contains("tax DECIMAL(10, 2)")); assertTrue(creatingTable.contains("tax2 DECIMAL(10, 2)")); assertTrue(creatingTable.contains("exchange_rate DECIMAL(10, 10)")); assertTrue(creatingTable.contains("rcpt_date DATE")); assertTrue(creatingTable.contains("timezone TEXT")); assertTrue(creatingTable.contains("comment TEXT")); assertTrue(creatingTable.contains("expenseable BOOLEAN")); assertTrue(creatingTable.contains("isocode TEXT")); assertTrue(creatingTable.contains("paymentMethodKey INTEGER")); assertTrue(creatingTable.contains("fullpageimage BOOLEAN")); assertTrue(creatingTable.contains("receipt_processing_status TEXT")); assertTrue(creatingTable.contains("extra_edittext_1 TEXT")); assertTrue(creatingTable.contains("extra_edittext_2 TEXT")); assertTrue(creatingTable.contains("extra_edittext_3 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("name_hidden_auto_complete BOOLEAN DEFAULT 0")); assertTrue(creatingTable.contains("comment_hidden_auto_complete BOOLEAN DEFAULT 0")); }