use of com.pushtorefresh.storio3.contentresolver.StorIOContentResolver in project storio by pushtorefresh.
the class DefaultStorIOContentResolverTest method typeMappingShouldWorkWithoutSpecifiedTypeMappingFinder.
@Test
public void typeMappingShouldWorkWithoutSpecifiedTypeMappingFinder() {
// noinspection unchecked
ContentResolverTypeMapping<ClassEntity> typeMapping = ContentResolverTypeMapping.builder().putResolver(mock(PutResolver.class)).getResolver(mock(GetResolver.class)).deleteResolver(mock(DeleteResolver.class)).build();
StorIOContentResolver storIOContentResolver = DefaultStorIOContentResolver.builder().contentResolver(mock(ContentResolver.class)).addTypeMapping(ClassEntity.class, typeMapping).build();
assertThat(storIOContentResolver.lowLevel().typeMapping(ClassEntity.class)).isEqualTo(typeMapping);
}
use of com.pushtorefresh.storio3.contentresolver.StorIOContentResolver in project storio by pushtorefresh.
the class DefaultStorIOContentResolverTest method defaultSchedulerReturnsIOSchedulerIfNotSpecified.
@Test
public void defaultSchedulerReturnsIOSchedulerIfNotSpecified() {
StorIOContentResolver storIOContentResolver = DefaultStorIOContentResolver.builder().contentResolver(mock(ContentResolver.class)).build();
assertThat(storIOContentResolver.defaultRxScheduler()).isSameAs(Schedulers.io());
}
use of com.pushtorefresh.storio3.contentresolver.StorIOContentResolver in project storio by pushtorefresh.
the class RxJavaUtils method createCompletable.
@CheckResult
@NonNull
public static <Result, Data> Completable createCompletable(@NonNull StorIOContentResolver storIOContentResolver, @NonNull PreparedCompletableOperation<Result, Data> operation) {
throwExceptionIfRxJava2IsNotAvailable("asRxCompletable()");
final Completable completable = Completable.create(new CompletableOnSubscribeExecuteAsBlocking(operation));
return subscribeOn(storIOContentResolver, completable);
}
use of com.pushtorefresh.storio3.contentresolver.StorIOContentResolver in project storio by pushtorefresh.
the class DefaultDeleteResolver method performDelete.
/**
* {@inheritDoc}
*/
@NonNull
@Override
public DeleteResult performDelete(@NonNull StorIOContentResolver storIOContentResolver, @NonNull T object) {
final DeleteQuery deleteQuery = mapToDeleteQuery(object);
final int numberOfRowsDeleted = storIOContentResolver.lowLevel().delete(deleteQuery);
return DeleteResult.newInstance(numberOfRowsDeleted, deleteQuery.uri());
}
use of com.pushtorefresh.storio3.contentresolver.StorIOContentResolver in project storio by pushtorefresh.
the class DefaultStorIOContentResolverTest method shouldUseSpecifiedTypeMappingFinder.
@Test
public void shouldUseSpecifiedTypeMappingFinder() throws NoSuchFieldException, IllegalAccessException {
TypeMappingFinder typeMappingFinder = mock(TypeMappingFinder.class);
DefaultStorIOContentResolver storIOContentResolver = DefaultStorIOContentResolver.builder().contentResolver(mock(ContentResolver.class)).typeMappingFinder(typeMappingFinder).build();
assertThat(getTypeMappingFinder(storIOContentResolver)).isEqualTo(typeMappingFinder);
}
Aggregations