use of com.pushtorefresh.storio3.sqlite.queries.RawQuery in project storio by pushtorefresh.
the class DefaultStorIOSQLiteTest method shouldPassSQLWithoutArgsToExecSQL.
@Test
public void shouldPassSQLWithoutArgsToExecSQL() {
RawQuery rawQuery = RawQuery.builder().query("DROP TABLE IF EXISTS someTable").build();
storIOSQLite.lowLevel().executeSQL(rawQuery);
verify(sqLiteOpenHelper).getWritableDatabase();
verify(sqLiteDatabase).execSQL(eq(rawQuery.query()));
verifyNoMoreInteractions(sqLiteOpenHelper, sqLiteDatabase);
}
use of com.pushtorefresh.storio3.sqlite.queries.RawQuery in project storio by pushtorefresh.
the class RxJavaUtilsTest method createGetFlowableOptionalCompletedAfterInitialEmissionIfNoTablesAndTags.
@Test
public void createGetFlowableOptionalCompletedAfterInitialEmissionIfNoTablesAndTags() {
RawQuery queryWithoutTablesAnTags = RawQuery.builder().query("select * from " + UserTableMeta.TABLE + " where " + UserTableMeta.COLUMN_ID + "=?").args(1).build();
PreparedGetObject<User> preparedGet = storIOSQLite.get().object(User.class).withQuery(queryWithoutTablesAnTags).prepare();
TestSubscriber<Optional<User>> subscriber = new TestSubscriber<Optional<User>>();
RxJavaUtils.createGetFlowableOptional(storIOSQLite, preparedGet, null, queryWithoutTablesAnTags, BackpressureStrategy.LATEST).subscribe(subscriber);
subscriber.assertNoErrors();
subscriber.assertValues(Optional.<User>empty());
subscriber.assertComplete();
}
use of com.pushtorefresh.storio3.sqlite.queries.RawQuery in project storio by pushtorefresh.
the class RxJavaUtilsTest method createGetFlowableCompletedAfterInitialEmissionIfNoTablesAndTags.
@Test
public void createGetFlowableCompletedAfterInitialEmissionIfNoTablesAndTags() {
RawQuery queryWithoutTablesAnTags = RawQuery.builder().query("select * from " + UserTableMeta.TABLE).build();
PreparedGetListOfObjects<User> preparedGet = storIOSQLite.get().listOfObjects(User.class).withQuery(queryWithoutTablesAnTags).prepare();
TestSubscriber<List<User>> subscriber = new TestSubscriber<List<User>>();
RxJavaUtils.createGetFlowable(storIOSQLite, preparedGet, null, queryWithoutTablesAnTags, BackpressureStrategy.LATEST).subscribe(subscriber);
subscriber.assertNoErrors();
subscriber.assertValues(EMPTY_LIST);
subscriber.assertComplete();
}
Aggregations