DistanceTable extends TripForeignKeyAbstractSqlTable<Distance> { @Override public synchronized void onCreate(@NonNull SQLiteDatabase db, @NonNull TableDefaultsCustomizer customizer) { super.onCreate(db, customizer); final String sql = "CREATE TABLE " + TABLE_NAME + " (" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + COLUMN_PARENT_TRIP_ID + " INTEGER REFERENCES " + TripsTable.COLUMN_NAME + " ON DELETE CASCADE," + COLUMN_DISTANCE + " DECIMAL(10, 2) DEFAULT 0.00," + COLUMN_LOCATION + " TEXT," + COLUMN_DATE + " DATE," + COLUMN_TIMEZONE + " TEXT," + COLUMN_COMMENT + " TEXT," + COLUMN_RATE_CURRENCY + " TEXT NOT NULL, " + COLUMN_RATE + " DECIMAL(10, 2) DEFAULT 0.00, " + COLUMN_PAYMENT_METHOD_ID + " INTEGER REFERENCES " + PaymentMethodsTable.TABLE_NAME + " ON DELETE NO ACTION, " + COLUMN_LOCATION_HIDDEN_AUTO_COMPLETE + " BOOLEAN DEFAULT 0, " + COLUMN_COMMENT_HIDDEN_AUTO_COMPLETE + " 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_UUID + " TEXT " + ");"; Logger.debug(this, sql); db.execSQL(sql); } DistanceTable(@NonNull SQLiteOpenHelper sqLiteOpenHelper, @NonNull Table<Trip> tripsTable,
                         @NonNull Table<PaymentMethod> paymentMethodTable, @NonNull UserPreferenceManager userPreferenceManager); @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_PARENT_TRIP_ID; static final String COLUMN_DISTANCE; static final String COLUMN_LOCATION; static final String COLUMN_DATE; static final String COLUMN_TIMEZONE; static final String COLUMN_COMMENT; static final String COLUMN_RATE; static final String COLUMN_RATE_CURRENCY; static final String COLUMN_PAYMENT_METHOD_ID; static final String COLUMN_LOCATION_HIDDEN_AUTO_COMPLETE; static final String COLUMN_COMMENT_HIDDEN_AUTO_COMPLETE; @Deprecated
    static final String COLUMN_PARENT; }
@Test public void onCreate() { final TableDefaultsCustomizer customizer = mock(TableDefaultsCustomizer.class); mDistanceTable.onCreate(mSQLiteDatabase, customizer); verify(mSQLiteDatabase).execSQL(mSqlCaptor.capture()); verifyZeroInteractions(customizer); assertTrue(mSqlCaptor.getValue().contains("CREATE TABLE distance")); assertTrue(mSqlCaptor.getValue().contains("id INTEGER PRIMARY KEY AUTOINCREMENT")); assertTrue(mSqlCaptor.getValue().contains("parentKey INTEGER")); assertTrue(mSqlCaptor.getValue().contains("distance DECIMAL(10, 2)")); assertTrue(mSqlCaptor.getValue().contains("location TEXT")); assertTrue(mSqlCaptor.getValue().contains("date DATE")); assertTrue(mSqlCaptor.getValue().contains("timezone TEXT")); assertTrue(mSqlCaptor.getValue().contains("comment TEXT")); assertTrue(mSqlCaptor.getValue().contains("rate DECIMAL(10, 2)")); assertTrue(mSqlCaptor.getValue().contains("rate_currency TEXT")); assertTrue(mSqlCaptor.getValue().contains("drive_sync_id TEXT")); assertTrue(mSqlCaptor.getValue().contains("drive_is_synced BOOLEAN DEFAULT 0")); assertTrue(mSqlCaptor.getValue().contains("drive_marked_for_deletion BOOLEAN DEFAULT 0")); assertTrue(mSqlCaptor.getValue().contains("last_local_modification_time DATE")); assertTrue(mSqlCaptor.getValue().contains("entity_uuid TEXT")); assertTrue(mSqlCaptor.getValue().contains("location_hidden_auto_complete BOOLEAN DEFAULT 0")); assertTrue(mSqlCaptor.getValue().contains("comment_hidden_auto_complete BOOLEAN DEFAULT 0")); }