use of com.pushtorefresh.storio.TypeMappingFinder 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);
}
use of com.pushtorefresh.storio.TypeMappingFinder in project storio by pushtorefresh.
the class DefaultStorIOContentResolverTest method getTypeMappingFinder.
@Nullable
private static TypeMappingFinder getTypeMappingFinder(@NonNull DefaultStorIOContentResolver storIOContentResolver) throws NoSuchFieldException, IllegalAccessException {
Field field = DefaultStorIOContentResolver.LowLevelImpl.class.getDeclaredField("typeMappingFinder");
field.setAccessible(true);
return (TypeMappingFinder) field.get(storIOContentResolver.lowLevel());
}
use of com.pushtorefresh.storio.TypeMappingFinder in project storio by pushtorefresh.
the class DefaultStorIOContentResolverTest method typeMappingShouldWorkWithSpecifiedTypeMappingFinder.
@Test
public void typeMappingShouldWorkWithSpecifiedTypeMappingFinder() {
TypeMappingFinder typeMappingFinder = new TypeMappingFinderImpl();
//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)).typeMappingFinder(typeMappingFinder).addTypeMapping(ClassEntity.class, typeMapping).build();
assertThat(storIOContentResolver.lowLevel().typeMapping(ClassEntity.class)).isEqualTo(typeMapping);
}
use of com.pushtorefresh.storio.TypeMappingFinder in project storio by pushtorefresh.
the class DefaultStorIOSQLiteTest method shouldUseSpecifiedTypeMappingFinder.
@Test
public void shouldUseSpecifiedTypeMappingFinder() throws NoSuchFieldException, IllegalAccessException {
TypeMappingFinder typeMappingFinder = mock(TypeMappingFinder.class);
DefaultStorIOSQLite storIOSQLite = DefaultStorIOSQLite.builder().sqliteOpenHelper(mock(SQLiteOpenHelper.class)).typeMappingFinder(typeMappingFinder).build();
assertThat(getTypeMappingFinder(storIOSQLite)).isEqualTo(typeMappingFinder);
}
use of com.pushtorefresh.storio.TypeMappingFinder in project storio by pushtorefresh.
the class DefaultStorIOContentResolverTest method deprecatedInternalImplShouldReturnSentToConstructorTypeMapping.
@Test
public void deprecatedInternalImplShouldReturnSentToConstructorTypeMapping() throws NoSuchFieldException, IllegalAccessException {
ContentResolver contentResolver = mock(ContentResolver.class);
TypeMappingFinder typeMappingFinder = mock(TypeMappingFinder.class);
TestDefaultStorIOContentResolver storIOContentResolver = new TestDefaultStorIOContentResolver(contentResolver, mock(Handler.class), typeMappingFinder);
assertThat(storIOContentResolver.typeMappingFinder()).isSameAs(typeMappingFinder);
}
Aggregations