public void run() throws Exception { SQLiteDatabase db = SQLiteDatabase.create(null); prepareData(db); mApp = newGalleryContext(db, Looper.getMainLooper()); Path.clearAll(); Path path = Path.fromString(mIsImage ? "/local/image" : "/local/video"); mAlbumSet = new LocalAlbumSet(path, mApp); mAlbumSet.reload(); verifyResult(); }
@Before public void setUp() throws Exception { database = SQLiteDatabase.create(null); database.execSQL("CREATE TABLE table_name(_id INT PRIMARY KEY, name VARCHAR(255));"); String[] inserts = { "INSERT INTO table_name (_id, name) VALUES(1234, 'Chuck');", "INSERT INTO table_name (_id, name) VALUES(1235, 'Julie');", "INSERT INTO table_name (_id, name) VALUES(1236, 'Chris');", "INSERT INTO table_name (_id, name) VALUES(1237, 'Brenda');", "INSERT INTO table_name (_id, name) VALUES(1238, 'Jane');" }; for (String insert : inserts) { database.execSQL(insert); } String sql = "SELECT * FROM table_name;"; curs = database.rawQuery(sql, null); adapter = new TestAdapter(curs); }
@Test public void shouldUseInMemoryDatabaseWhenCallingCreate() throws Exception { SQLiteDatabase db = SQLiteDatabase.create(null); assertThat(db.isOpen()).isTrue(); }
@Override protected void setUp() throws Exception { super.setUp(); mDatabase = SQLiteDatabase.create(null); mDatabase.execSQL("CREATE TABLE test (id INTEGER PRIMARY KEY, data TEXT COLLATE LOCALIZED);"); }