Search in sources :

Example 21 with StorIOSQLite

use of com.pushtorefresh.storio3.sqlite.StorIOSQLite in project storio by pushtorefresh.

the class SchedulerChecker method check.

private void check(@NonNull PreparedOperation operation) {
    final PreparedOperation operationSpy = spy(operation);
    verify(storIOSQLite).defaultRxScheduler();
    operationSpy.asRxFlowable(MISSING).subscribe();
    verify(operationSpy, never()).executeAsBlocking();
    scheduler.triggerActions();
    verify(operationSpy).executeAsBlocking();
}
Also used : PreparedOperation(com.pushtorefresh.storio3.operations.PreparedOperation)

Example 22 with StorIOSQLite

use of com.pushtorefresh.storio3.sqlite.StorIOSQLite in project storio by pushtorefresh.

the class DeleteOperationDesignTest method deleteObjectBlocking.

@Test
public void deleteObjectBlocking() {
    User user = newUser();
    DeleteResult deleteResult = storIOSQLite().delete().object(user).withDeleteResolver(UserTableMeta.DELETE_RESOLVER).prepare().executeAsBlocking();
}
Also used : DeleteResult(com.pushtorefresh.storio3.sqlite.operations.delete.DeleteResult) Test(org.junit.Test)

Example 23 with StorIOSQLite

use of com.pushtorefresh.storio3.sqlite.StorIOSQLite in project storio by pushtorefresh.

the class PutOperationDesignTest method putObjectBlocking.

@Test
public void putObjectBlocking() {
    User user = newUser();
    PutResult putResult = storIOSQLite().put().object(user).withPutResolver(UserTableMeta.PUT_RESOLVER).prepare().executeAsBlocking();
}
Also used : PutResult(com.pushtorefresh.storio3.sqlite.operations.put.PutResult) Test(org.junit.Test)

Example 24 with StorIOSQLite

use of com.pushtorefresh.storio3.sqlite.StorIOSQLite in project storio by pushtorefresh.

the class DefaultStorIOSQLiteTest method defaultSchedulerReturnsSpecifiedScheduler.

@Test
public void defaultSchedulerReturnsSpecifiedScheduler() {
    Scheduler scheduler = mock(Scheduler.class);
    StorIOSQLite storIOSQLite = DefaultStorIOSQLite.builder().sqliteOpenHelper(sqLiteOpenHelper).defaultRxScheduler(scheduler).build();
    assertThat(storIOSQLite.defaultRxScheduler()).isSameAs(scheduler);
}
Also used : Scheduler(io.reactivex.Scheduler) StorIOSQLite(com.pushtorefresh.storio3.sqlite.StorIOSQLite) Test(org.junit.Test)

Example 25 with StorIOSQLite

use of com.pushtorefresh.storio3.sqlite.StorIOSQLite in project storio by pushtorefresh.

the class DefaultStorIOSQLiteTest method typeMappingShouldWorkWithSpecifiedTypeMappingFinder.

@Test
public void typeMappingShouldWorkWithSpecifiedTypeMappingFinder() {
    TypeMappingFinder typeMappingFinder = new TypeMappingFinderImpl();
    // noinspection unchecked
    SQLiteTypeMapping<ClassEntity> typeMapping = SQLiteTypeMapping.builder().putResolver(mock(PutResolver.class)).getResolver(mock(GetResolver.class)).deleteResolver(mock(DeleteResolver.class)).build();
    DefaultStorIOSQLite storIOSQLite = DefaultStorIOSQLite.builder().sqliteOpenHelper(sqLiteOpenHelper).typeMappingFinder(typeMappingFinder).addTypeMapping(ClassEntity.class, typeMapping).build();
    assertThat(storIOSQLite.lowLevel().typeMapping(ClassEntity.class)).isEqualTo(typeMapping);
}
Also used : TypeMappingFinderImpl(com.pushtorefresh.storio3.internal.TypeMappingFinderImpl) TypeMappingFinder(com.pushtorefresh.storio3.TypeMappingFinder) GetResolver(com.pushtorefresh.storio3.sqlite.operations.get.GetResolver) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)34 StorIOSQLite (com.pushtorefresh.storio3.sqlite.StorIOSQLite)32 NonNull (android.support.annotation.NonNull)18 StorIOException (com.pushtorefresh.storio3.StorIOException)18 ContentValues (android.content.ContentValues)13 Query (com.pushtorefresh.storio3.sqlite.queries.Query)9 Cursor (android.database.Cursor)8 TestObserver (io.reactivex.observers.TestObserver)8 DeleteQuery (com.pushtorefresh.storio3.sqlite.queries.DeleteQuery)7 TestSubscriber (io.reactivex.subscribers.TestSubscriber)7 TypeMappingFinder (com.pushtorefresh.storio3.TypeMappingFinder)4 Car (com.pushtorefresh.storio3.sample.many_to_many_sample.entities.Car)4 InsertQuery (com.pushtorefresh.storio3.sqlite.queries.InsertQuery)4 RawQuery (com.pushtorefresh.storio3.sqlite.queries.RawQuery)4 Tweet (com.pushtorefresh.storio3.sample.db.entities.Tweet)3 TweetWithUser (com.pushtorefresh.storio3.sample.db.entities.TweetWithUser)3 Person (com.pushtorefresh.storio3.sample.many_to_many_sample.entities.Person)3 PutResult (com.pushtorefresh.storio3.sqlite.operations.put.PutResult)3 User (com.pushtorefresh.storio3.sample.db.entities.User)2 BaseTest (com.pushtorefresh.storio3.sqlite.integration.BaseTest)2